2008-02-21 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>

Log more detailed information about each message.
	* src/DHTQueryMessage.{h, cc}
	* src/DHTGetPeersMessage.{h, cc}
	* src/DHTFindNodeReplyMessage.{h, cc}
	* src/DHTGetPeersReplyMessage.{h, cc}
	* src/DHTAnnouncePeerMessage.{h, cc}
	* src/DHTResponseMessage.{h, cc}
	* src/DHTFindNodeMessage.{h, cc}
pull/1/head
Tatsuhiro Tsujikawa 2008-02-21 12:25:26 +00:00
parent a8eeb81883
commit 7e6d037c97
15 changed files with 62 additions and 2 deletions

View File

@ -1,3 +1,14 @@
2008-02-21 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Log more detailed information about each message.
* src/DHTQueryMessage.{h, cc}
* src/DHTGetPeersMessage.{h, cc}
* src/DHTFindNodeReplyMessage.{h, cc}
* src/DHTGetPeersReplyMessage.{h, cc}
* src/DHTAnnouncePeerMessage.{h, cc}
* src/DHTResponseMessage.{h, cc}
* src/DHTFindNodeMessage.{h, cc}
2008-02-21 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Use constants defined in prefs.h

View File

@ -44,6 +44,7 @@
#include "DHTPeerAnnounceStorage.h"
#include "DHTTokenTracker.h"
#include "DlAbortEx.h"
#include "BtConstants.h"
#include <cstring>
namespace aria2 {
@ -115,4 +116,11 @@ void DHTAnnouncePeerMessage::setTokenTracker(const WeakHandle<DHTTokenTracker>&
_tokenTracker = tokenTracker;
}
std::string DHTAnnouncePeerMessage::toStringOptional() const
{
return "token="+Util::toHex(_token)+
", info_hash="+Util::toHex(_infoHash, INFO_HASH_LENGTH)+
", tcpPort="+Util::uitos(_tcpPort);
}
} // namespace aria2

View File

@ -54,6 +54,8 @@ private:
WeakHandle<DHTPeerAnnounceStorage> _peerAnnounceStorage;
WeakHandle<DHTTokenTracker> _tokenTracker;
protected:
virtual std::string toStringOptional() const;
public:
DHTAnnouncePeerMessage(const SharedHandle<DHTNode>& localNode,
const SharedHandle<DHTNode>& remoteNode,

View File

@ -40,6 +40,7 @@
#include "DHTMessageFactory.h"
#include "DHTMessageDispatcher.h"
#include "DHTMessageCallback.h"
#include "Util.h"
#include <cstring>
namespace aria2 {
@ -80,4 +81,9 @@ std::string DHTFindNodeMessage::getMessageType() const
void DHTFindNodeMessage::validate() const {}
std::string DHTFindNodeMessage::toStringOptional() const
{
return "targetNodeID="+Util::toHex(_targetNodeID, DHT_ID_LENGTH);
}
} // namespace aria2

View File

@ -43,6 +43,8 @@ namespace aria2 {
class DHTFindNodeMessage:public DHTQueryMessage {
private:
unsigned char _targetNodeID[DHT_ID_LENGTH];
protected:
virtual std::string toStringOptional() const;
public:
DHTFindNodeMessage(const SharedHandle<DHTNode>& localNode,
const SharedHandle<DHTNode>& remoteNode,

View File

@ -42,6 +42,7 @@
#include "DHTMessageDispatcher.h"
#include "DHTMessageCallback.h"
#include "PeerMessageUtil.h"
#include "Util.h"
#include <cstring>
namespace aria2 {
@ -97,4 +98,9 @@ void DHTFindNodeReplyMessage::setClosestKNodes(const std::deque<SharedHandle<DHT
_closestKNodes = closestKNodes;
}
std::string DHTFindNodeReplyMessage::toStringOptional() const
{
return "nodes="+Util::uitos(_closestKNodes.size());
}
} // namespace aria2

View File

@ -43,6 +43,8 @@ namespace aria2 {
class DHTFindNodeReplyMessage:public DHTResponseMessage {
private:
std::deque<SharedHandle<DHTNode> > _closestKNodes;
protected:
virtual std::string toStringOptional() const;
public:
DHTFindNodeReplyMessage(const SharedHandle<DHTNode>& localNode,
const SharedHandle<DHTNode>& remoteNode,

View File

@ -44,6 +44,7 @@
#include "DHTUtil.h"
#include "Peer.h"
#include "DHTTokenTracker.h"
#include "Util.h"
#include <cstring>
namespace aria2 {
@ -105,4 +106,9 @@ void DHTGetPeersMessage::setTokenTracker(const WeakHandle<DHTTokenTracker>& toke
_tokenTracker = tokenTracker;
}
std::string DHTGetPeersMessage::toStringOptional() const
{
return "info_hash="+Util::toHex(_infoHash, INFO_HASH_LENGTH);
}
} // namespace aria2

View File

@ -50,6 +50,8 @@ private:
WeakHandle<DHTPeerAnnounceStorage> _peerAnnounceStorage;
WeakHandle<DHTTokenTracker> _tokenTracker;
protected:
virtual std::string toStringOptional() const;
public:
DHTGetPeersMessage(const SharedHandle<DHTNode>& localNode,
const SharedHandle<DHTNode>& remoteNode,

View File

@ -45,6 +45,7 @@
#include "PeerMessageUtil.h"
#include "Peer.h"
#include "DHTUtil.h"
#include "Util.h"
#include <cstring>
namespace aria2 {
@ -121,4 +122,10 @@ void DHTGetPeersReplyMessage::setValues(const std::deque<SharedHandle<Peer> >& p
_values = peers;
}
std::string DHTGetPeersReplyMessage::toStringOptional() const
{
return "token="+Util::toHex(_token)+", values="+Util::uitos(_values.size())+
", nodes="+Util::uitos(_closestKNodes.size());
}
} // namespace aria2

View File

@ -50,6 +50,8 @@ private:
std::deque<SharedHandle<DHTNode> > _closestKNodes;
std::deque<SharedHandle<Peer> > _values;
protected:
virtual std::string toStringOptional() const;
public:
DHTGetPeersReplyMessage(const SharedHandle<DHTNode>& localNode,
const SharedHandle<DHTNode>& remoteNode,

View File

@ -69,7 +69,8 @@ std::string DHTQueryMessage::toString() const
" TransactionID="+Util::toHex(_transactionID)+
" Remote:"+
_remoteNode->getIPAddress()+":"+Util::itos(_remoteNode->getPort())+
", id="+Util::toHex(_remoteNode->getID(), DHT_ID_LENGTH);
", id="+Util::toHex(_remoteNode->getID(), DHT_ID_LENGTH)+
", "+toStringOptional();
}
} // namespace aria2

View File

@ -40,6 +40,8 @@
namespace aria2 {
class DHTQueryMessage:public DHTAbstractMessage {
protected:
virtual std::string toStringOptional() const { return ""; }
public:
DHTQueryMessage(const SharedHandle<DHTNode>& localNode,
const SharedHandle<DHTNode>& remoteNode,

View File

@ -68,7 +68,8 @@ std::string DHTResponseMessage::toString() const
" TransactionID="+Util::toHex(_transactionID)+
" Remote:"+
_remoteNode->getIPAddress()+":"+Util::itos(_remoteNode->getPort())+
", id="+Util::toHex(_remoteNode->getID(), DHT_ID_LENGTH);
", id="+Util::toHex(_remoteNode->getID(), DHT_ID_LENGTH)+
", "+toStringOptional();
}
} // namespace aria2

View File

@ -40,6 +40,8 @@
namespace aria2 {
class DHTResponseMessage:public DHTAbstractMessage {
protected:
virtual std::string toStringOptional() const { return ""; }
public:
DHTResponseMessage(const SharedHandle<DHTNode>& localNode,
const SharedHandle<DHTNode>& remoteNode,