Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Throw std::invalid_argument.
[simgrid.git] / examples / s4u / app-bittorrent / s4u-tracker.cpp
index 90dac0a..a8a3446 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2018. The SimGrid Team.
+/* Copyright (c) 2012-2019. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
@@ -17,8 +17,8 @@ Tracker::Tracker(std::vector<std::string> args)
   // Retrieving end time
   try {
     deadline = std::stod(args[1]);
-  } catch (std::invalid_argument& ia) {
-    throw std::invalid_argument(std::string("Invalid deadline:") + args[1].c_str());
+  } catch (const std::invalid_argument&) {
+    throw std::invalid_argument("Invalid deadline:" + args[1]);
   }
   xbt_assert(deadline > 0, "Wrong deadline supplied");
 
@@ -56,7 +56,7 @@ void Tracker::operator()()
         do {
           next_peer = known_peers.begin();
           std::advance(next_peer, RngStream_RandInt(stream, 0, nb_known_peers - 1));
-        } while (ta->getPeers()->find(*next_peer) != ta->getPeers()->end());
+        } while (ta->getPeers().find(*next_peer) != ta->getPeers().end());
         ta->addPeer(*next_peer);
         tried++;
       }