diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2010-11-20 08:21:36 +0000 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2010-11-20 08:21:36 +0000 |
| commit | 580098eb4929a3bdbf424af18da361259ef2efe5 (patch) | |
| tree | c6ff77fa55fcbdcdd0ca21ec2105db14a8c050d3 /src/LpdReceiveMessageCommand.cc | |
| parent | 3940da75624b194cdd5036f9fe330fcecc725964 (diff) | |
2010-11-20 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Rewritten Logger interface. Logger now writes source file name and
line number in log file.
Diffstat (limited to 'src/LpdReceiveMessageCommand.cc')
| -rw-r--r-- | src/LpdReceiveMessageCommand.cc | 37 |
1 files changed, 17 insertions, 20 deletions
diff --git a/src/LpdReceiveMessageCommand.cc b/src/LpdReceiveMessageCommand.cc index 594fa16a..741c6033 100644 --- a/src/LpdReceiveMessageCommand.cc +++ b/src/LpdReceiveMessageCommand.cc @@ -43,9 +43,11 @@ #include "RequestGroup.h" #include "BtRegistry.h" #include "Logger.h" +#include "LogFactory.h" #include "LpdMessage.h" #include "bittorrent_helper.h" #include "util.h" +#include "fmt.h" namespace aria2 { @@ -54,8 +56,12 @@ unsigned int LpdReceiveMessageCommand::numInstance_ = 0; LpdReceiveMessageCommand* LpdReceiveMessageCommand::instance_ = 0; LpdReceiveMessageCommand::LpdReceiveMessageCommand -(cuid_t cuid, const SharedHandle<LpdMessageReceiver>& receiver, - DownloadEngine* e):Command(cuid), receiver_(receiver), e_(e) +(cuid_t cuid, + const SharedHandle<LpdMessageReceiver>& receiver, + DownloadEngine* e) + : Command(cuid), + receiver_(receiver), + e_(e) { e_->addSocketForReadCheck(receiver_->getSocket(), this); ++numInstance_; @@ -88,17 +94,12 @@ bool LpdReceiveMessageCommand::execute() SharedHandle<DownloadContext> dctx = reg->getDownloadContext(m->getInfoHash()); if(!dctx) { - if(getLogger()->debug()) { - getLogger()->debug("Download Context is null for infohash=%s.", - util::toHex(m->getInfoHash()).c_str()); - } + A2_LOG_DEBUG(fmt("Download Context is null for infohash=%s.", + util::toHex(m->getInfoHash()).c_str())); continue; } if(bittorrent::getTorrentAttrs(dctx)->privateTorrent) { - if(getLogger()->debug()) { - getLogger()->debug - ("Ignore LPD message because the torrent is private."); - } + A2_LOG_DEBUG("Ignore LPD message because the torrent is private."); continue; } RequestGroup* group = dctx->getOwnerRequestGroup(); @@ -109,17 +110,13 @@ bool LpdReceiveMessageCommand::execute() assert(peerStorage); SharedHandle<Peer> peer = m->getPeer(); if(peerStorage->addPeer(peer)) { - if(getLogger()->debug()) { - getLogger()->debug("LPD peer %s:%u local=%d added.", - peer->getIPAddress().c_str(), peer->getPort(), - peer->isLocalPeer()?1:0); - } + A2_LOG_DEBUG(fmt("LPD peer %s:%u local=%d added.", + peer->getIPAddress().c_str(), peer->getPort(), + peer->isLocalPeer()?1:0)); } else { - if(getLogger()->debug()) { - getLogger()->debug("LPD peer %s:%u local=%d not added.", - peer->getIPAddress().c_str(), peer->getPort(), - peer->isLocalPeer()?1:0); - } + A2_LOG_DEBUG(fmt("LPD peer %s:%u local=%d not added.", + peer->getIPAddress().c_str(), peer->getPort(), + peer->isLocalPeer()?1:0)); } } e_->addCommand(this); |
