Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
smpi: fix issue with message IDs. In case of persistent request reused multiple times...
[simgrid.git] / examples / cpp / app-bittorrent / s4u-peer.cpp
index bcbde2c05c0f1086a877d5b2335e7007c66638bd..43f7f46a74dae075121d3a0477bb3faef158c934 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2022. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2012-2023. The SimGrid Team. All rights reserved.          */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
@@ -43,14 +43,14 @@ constexpr unsigned message_size(MessageType type)
                                             /* REQUEST       */ 17,
                                             /* PIECE         */ 13,
                                             /* CANCEL        */ 17}};
-  return sizes[static_cast<int>(type)];
+  return sizes.at(static_cast<int>(type));
 }
 
 constexpr const char* message_name(MessageType type)
 {
   constexpr std::array<const char*, 10> names{{"HANDSHAKE", "CHOKE", "UNCHOKE", "INTERESTED", "NOTINTERESTED", "HAVE",
                                                "BITFIELD", "REQUEST", "PIECE", "CANCEL"}};
-  return names[static_cast<int>(type)];
+  return names.at(static_cast<int>(type));
 }
 
 Peer::Peer(std::vector<std::string> args)