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/LpdMessageDispatcher.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/LpdMessageDispatcher.cc')
| -rw-r--r-- | src/LpdMessageDispatcher.cc | 46 |
1 files changed, 22 insertions, 24 deletions
diff --git a/src/LpdMessageDispatcher.cc b/src/LpdMessageDispatcher.cc index 629e5dff..ba2bbdf7 100644 --- a/src/LpdMessageDispatcher.cc +++ b/src/LpdMessageDispatcher.cc @@ -39,22 +39,25 @@ #include "BtConstants.h" #include "RecoverableException.h" #include "wallclock.h" +#include "fmt.h" namespace aria2 { LpdMessageDispatcher::LpdMessageDispatcher -(const std::string& infoHash, uint16_t port, - const std::string& multicastAddress, uint16_t multicastPort, - time_t interval): - infoHash_(infoHash), - port_(port), - multicastAddress_(multicastAddress), - multicastPort_(multicastPort), - timer_(0), - interval_(interval), - request_(bittorrent::createLpdRequest(multicastAddress_, multicastPort_, - infoHash_, port_)), - logger_(LogFactory::getInstance()) {} +(const std::string& infoHash, + uint16_t port, + const std::string& multicastAddress, + uint16_t multicastPort, + time_t interval) + : infoHash_(infoHash), + port_(port), + multicastAddress_(multicastAddress), + multicastPort_(multicastPort), + timer_(0), + interval_(interval), + request_(bittorrent::createLpdRequest(multicastAddress_, multicastPort_, + infoHash_, port_)) +{} LpdMessageDispatcher::~LpdMessageDispatcher() {} @@ -64,23 +67,18 @@ bool LpdMessageDispatcher::init(const std::string& localAddr, try { socket_.reset(new SocketCore(SOCK_DGRAM)); socket_->create(AF_INET); - if(logger_->debug()) { - logger_->debug("Setting multicast outgoing interface=%s", - localAddr.c_str()); - } + A2_LOG_DEBUG(fmt("Setting multicast outgoing interface=%s", + localAddr.c_str())); socket_->setMulticastInterface(localAddr); - if(logger_->debug()) { - logger_->debug("Setting multicast ttl=%u",static_cast<unsigned int>(ttl)); - } + A2_LOG_DEBUG(fmt("Setting multicast ttl=%u", + static_cast<unsigned int>(ttl))); socket_->setMulticastTtl(ttl); - if(logger_->debug()) { - logger_->debug("Setting multicast loop=%u", - static_cast<unsigned int>(loop)); - } + A2_LOG_DEBUG(fmt("Setting multicast loop=%u", + static_cast<unsigned int>(loop))); socket_->setMulticastLoop(loop); return true; } catch(RecoverableException& e) { - logger_->error("Failed to initialize LpdMessageDispatcher.", e); + A2_LOG_ERROR_EX("Failed to initialize LpdMessageDispatcher.", e); } return false; } |
