Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Update copyright headers.
[simgrid.git] / examples / s4u / app-bittorrent / s4u-peer.cpp
index 8f9bc79..4d89148 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2012-2018. 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. */
@@ -129,13 +129,13 @@ void Peer::sendHandshakeToAllPeers()
 void Peer::sendMessage(simgrid::s4u::MailboxPtr mailbox, e_message_type type, uint64_t size)
 {
   const char* type_names[6] = {"HANDSHAKE", "CHOKE", "UNCHOKE", "INTERESTED", "NOTINTERESTED", "CANCEL"};
-  XBT_DEBUG("Sending %s to %s", type_names[type], mailbox->getCname());
+  XBT_DEBUG("Sending %s to %s", type_names[type], mailbox->get_cname());
   mailbox->put_init(new Message(type, id, bitfield_, mailbox_), size)->detach();
 }
 
 void Peer::sendBitfield(simgrid::s4u::MailboxPtr mailbox)
 {
-  XBT_DEBUG("Sending a BITFIELD to %s", mailbox->getCname());
+  XBT_DEBUG("Sending a BITFIELD to %s", mailbox->get_cname());
   mailbox
       ->put_init(new Message(MESSAGE_BITFIELD, id, bitfield_, mailbox_),
                  MESSAGE_BITFIELD_SIZE + BITS_TO_BYTES(FILE_PIECES))
@@ -145,7 +145,7 @@ void Peer::sendBitfield(simgrid::s4u::MailboxPtr mailbox)
 void Peer::sendPiece(simgrid::s4u::MailboxPtr mailbox, unsigned int piece, int block_index, int block_length)
 {
   xbt_assert(not hasNotPiece(piece), "Tried to send a unavailable piece.");
-  XBT_DEBUG("Sending the PIECE %u (%d,%d) to %s", piece, block_index, block_length, mailbox->getCname());
+  XBT_DEBUG("Sending the PIECE %u (%d,%d) to %s", piece, block_index, block_length, mailbox->get_cname());
   mailbox->put_init(new Message(MESSAGE_PIECE, id, mailbox_, piece, block_index, block_length), BLOCK_SIZE)->detach();
 }
 
@@ -165,7 +165,7 @@ void Peer::sendRequestTo(Connection* remote_peer, unsigned int piece)
   int block_index = getFirstMissingBlockFrom(piece);
   if (block_index != -1) {
     int block_length = std::min(BLOCKS_REQUESTED, PIECES_BLOCKS - block_index);
-    XBT_DEBUG("Sending a REQUEST to %s for piece %u (%d,%d)", remote_peer->mailbox_->getCname(), piece, block_index,
+    XBT_DEBUG("Sending a REQUEST to %s for piece %u (%d,%d)", remote_peer->mailbox_->get_cname(), piece, block_index,
               block_length);
     remote_peer->mailbox_
         ->put_init(new Message(MESSAGE_REQUEST, id, mailbox_, piece, block_index, block_length), MESSAGE_REQUEST_SIZE)
@@ -234,7 +234,7 @@ void Peer::leech()
 
   /* Send a "handshake" message to all the peers it got (since it couldn't have gotten more than 50 peers) */
   sendHandshakeToAllPeers();
-  XBT_DEBUG("Starting main leech loop listening on mailbox: %s", mailbox_->getCname());
+  XBT_DEBUG("Starting main leech loop listening on mailbox: %s", mailbox_->get_cname());
 
   void* data = nullptr;
   while (simgrid::s4u::Engine::getClock() < deadline && countPieces(bitfield_) < FILE_PIECES) {
@@ -300,7 +300,7 @@ void Peer::handleMessage()
   const char* type_names[10] = {"HANDSHAKE", "CHOKE",    "UNCHOKE", "INTERESTED", "NOTINTERESTED",
                                 "HAVE",      "BITFIELD", "REQUEST", "PIECE",      "CANCEL"};
 
-  XBT_DEBUG("Received a %s message from %s", type_names[message->type], message->return_mailbox->getCname());
+  XBT_DEBUG("Received a %s message from %s", type_names[message->type], message->return_mailbox->get_cname());
 
   auto known_peer         = connected_peers.find(message->peer_id);
   Connection* remote_peer = (known_peer == connected_peers.end()) ? nullptr : known_peer->second;