summaryrefslogtreecommitdiff
path: root/src/DefaultBtInteractive.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2010-03-21 07:05:49 +0000
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2010-03-21 07:05:49 +0000
commitde8fef01f3119719441b36c758fd5bd924bcf607 (patch)
tree61be92e32b982948d39421a4a58acfbb21e5e50c /src/DefaultBtInteractive.cc
parent322a0d1ad7e0ab0eaae6335baf91f5423b92c7f4 (diff)
2010-03-21 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Defined cuid_t as int64_t. Removed texts containing "CUID#%D" from translatable texts because it is used in log and debugging purpose.
Diffstat (limited to 'src/DefaultBtInteractive.cc')
-rw-r--r--src/DefaultBtInteractive.cc29
1 files changed, 19 insertions, 10 deletions
diff --git a/src/DefaultBtInteractive.cc b/src/DefaultBtInteractive.cc
index fd05ee39..5d55d98d 100644
--- a/src/DefaultBtInteractive.cc
+++ b/src/DefaultBtInteractive.cc
@@ -112,29 +112,38 @@ BtMessageHandle DefaultBtInteractive::receiveHandshake(bool quickReply) {
PEER_ID_LENGTH) == 0) {
throw DL_ABORT_EX
(StringFormat
- ("CUID#%d - Drop connection from the same Peer ID", cuid).str());
+ ("CUID#%s - Drop connection from the same Peer ID",
+ util::itos(cuid).c_str()).str());
}
peer->setPeerId(message->getPeerId());
if(message->isFastExtensionSupported()) {
peer->setFastExtensionEnabled(true);
- logger->info(MSG_FAST_EXTENSION_ENABLED, cuid);
+ if(logger->info()) {
+ logger->info(MSG_FAST_EXTENSION_ENABLED, util::itos(cuid).c_str());
+ }
}
if(message->isExtendedMessagingEnabled()) {
peer->setExtendedMessagingEnabled(true);
if(!_utPexEnabled) {
_extensionMessageRegistry->removeExtension("ut_pex");
}
- logger->info(MSG_EXTENDED_MESSAGING_ENABLED, cuid);
+ if(logger->info()) {
+ logger->info(MSG_EXTENDED_MESSAGING_ENABLED, util::itos(cuid).c_str());
+ }
}
if(message->isDHTEnabled()) {
peer->setDHTEnabled(true);
- logger->info(MSG_DHT_ENABLED_PEER, cuid);
+ if(logger->info()) {
+ logger->info(MSG_DHT_ENABLED_PEER, util::itos(cuid).c_str());
+ }
+ }
+ if(logger->info()) {
+ logger->info(MSG_RECEIVE_PEER_MESSAGE, util::itos(cuid).c_str(),
+ peer->ipaddr.c_str(), peer->port,
+ message->toString().c_str());
}
- logger->info(MSG_RECEIVE_PEER_MESSAGE, cuid,
- peer->ipaddr.c_str(), peer->port,
- message->toString().c_str());
return message;
}
@@ -267,7 +276,7 @@ size_t DefaultBtInteractive::receiveMessages() {
}
++msgcount;
if(logger->info()) {
- logger->info(MSG_RECEIVE_PEER_MESSAGE, cuid,
+ logger->info(MSG_RECEIVE_PEER_MESSAGE, util::itos(cuid).c_str(),
peer->ipaddr.c_str(), peer->port,
message->toString().c_str());
}
@@ -307,7 +316,7 @@ void DefaultBtInteractive::decideInterest() {
if(_pieceStorage->hasMissingPiece(peer)) {
if(!peer->amInterested()) {
if(logger->debug()) {
- logger->debug(MSG_PEER_INTERESTED, cuid);
+ logger->debug(MSG_PEER_INTERESTED, util::itos(cuid).c_str());
}
dispatcher->
addMessageToQueue(messageFactory->createInterestedMessage());
@@ -315,7 +324,7 @@ void DefaultBtInteractive::decideInterest() {
} else {
if(peer->amInterested()) {
if(logger->debug()) {
- logger->debug(MSG_PEER_NOT_INTERESTED, cuid);
+ logger->debug(MSG_PEER_NOT_INTERESTED, util::itos(cuid).c_str());
}
dispatcher->
addMessageToQueue(messageFactory->createNotInterestedMessage());