diff --git a/libbitdht/src/bitdht/bdmanager.cc b/libbitdht/src/bitdht/bdmanager.cc index abab11e0f..c9d1e40b1 100644 --- a/libbitdht/src/bitdht/bdmanager.cc +++ b/libbitdht/src/bitdht/bdmanager.cc @@ -54,7 +54,7 @@ * #define DEBUG_MGR_PKT 1 ***/ -//#define DEBUG_MGR 1 +#define DEBUG_MGR 1 bdNodeManager::bdNodeManager(bdNodeId *id, std::string dhtVersion, std::string bootfile, bdDhtFunctions *fns) :bdNode(id, dhtVersion, bootfile, fns) @@ -141,7 +141,7 @@ void bdNodeManager::iteration() if (modeAge > MAX_STARTUP_TIME) { #ifdef DEBUG_MGR - std::cerr << "bdNodeManager::iteration(): STARTUP "; + std::cerr << "bdNodeManager::iteration(): STARTUP -> REFRESH"; std::cerr << std::endl; #endif bdNodeId id; @@ -157,6 +157,10 @@ void bdNodeManager::iteration() case BITDHT_MGR_STATE_ACTIVE: if (modeAge > MAX_REFRESH_TIME) { +#ifdef DEBUG_MGR + std::cerr << "bdNodeManager::iteration(): ACTIVE -> REFRESH"; + std::cerr << std::endl; +#endif mMode = BITDHT_MGR_STATE_REFRESH; mModeTS = now; } @@ -165,6 +169,10 @@ void bdNodeManager::iteration() case BITDHT_MGR_STATE_REFRESH: { +#ifdef DEBUG_MGR + std::cerr << "bdNodeManager::iteration(): REFRESH -> ACTIVE"; + std::cerr << std::endl; +#endif /* select random ids, and perform searchs to refresh space */ mMode = BITDHT_MGR_STATE_ACTIVE; mModeTS = now; diff --git a/libbitdht/src/bitdht/bdnode.cc b/libbitdht/src/bitdht/bdnode.cc index bc1fa0b13..956d5caf8 100644 --- a/libbitdht/src/bitdht/bdnode.cc +++ b/libbitdht/src/bitdht/bdnode.cc @@ -215,8 +215,8 @@ void bdNode::iteration() genNewTransId(&transId); registerOutgoingMsg(&id, &transId, BITDHT_MSG_TYPE_FIND_NODE); - msgout_find_node(&id, &transId, &targetNodeId); #ifdef DEBUG_NODE_MSGS + msgout_find_node(&id, &transId, &targetNodeId); std::cerr << "bdNode::iteration() Find Node Req for : "; mFns->bdPrintId(std::cerr, &id); std::cerr << " searching for : "; @@ -371,7 +371,7 @@ void bdNode::addPeer(const bdId *id, uint32_t peerflags) #ifdef DEBUG_NODE_ACTIONS fprintf(stderr, "bdNode::addPeer("); - bdPrintId(std::cerr, id); + mFns->bdPrintId(std::cerr, id); fprintf(stderr, ")\n"); #endif @@ -484,8 +484,8 @@ void bdNode::processRemoteQuery() std::cerr << "bdNode::processRemoteQuery() Reply to Find Node: "; mFns->bdPrintId(std::cerr, &(query.mId)); std::cerr << " searching for : "; - bdPrintNodeId(std::cerr, &(query.mQuery)); - mFns->std::cerr << ", found " << nearest.size() << " nodes "; + mFns->bdPrintNodeId(std::cerr, &(query.mQuery)); + std::cerr << ", found " << nearest.size() << " nodes "; std::cerr << std::endl; #endif diff --git a/libbitdht/src/bitdht/bdstddht.h b/libbitdht/src/bitdht/bdstddht.h index 9f78252e9..feb4681f1 100644 --- a/libbitdht/src/bitdht/bdstddht.h +++ b/libbitdht/src/bitdht/bdstddht.h @@ -29,7 +29,7 @@ #include "bitdht/bdiface.h" -#define BITDHT_STANDARD_BUCKET_SIZE 20 +#define BITDHT_STANDARD_BUCKET_SIZE 10 // 20 - too many per query. #define BITDHT_STANDARD_BUCKET_SIZE_BITS 5 #define BITDHT_STANDARD_N_BUCKETS BITDHT_KEY_BITLEN diff --git a/libbitdht/src/udp/udpbitdht.cc b/libbitdht/src/udp/udpbitdht.cc index 5f5be167b..441a27f2d 100644 --- a/libbitdht/src/udp/udpbitdht.cc +++ b/libbitdht/src/udp/udpbitdht.cc @@ -42,6 +42,7 @@ /* * #define DEBUG_UDP_BITDHT 1 */ + //#define DEBUG_UDP_BITDHT 1 /*************************************/ diff --git a/libbitdht/src/udp/udplayer.cc b/libbitdht/src/udp/udplayer.cc index 94eeddd15..fe4a0163f 100644 --- a/libbitdht/src/udp/udplayer.cc +++ b/libbitdht/src/udp/udplayer.cc @@ -37,6 +37,8 @@ * #define DEBUG_UDP_LAYER 1 ***/ +//#define DEBUG_UDP_LAYER 1 + static const int UDP_DEF_TTL = 64; /* NB: This #define makes the listener open 0.0.0.0:X port instead @@ -77,7 +79,8 @@ class udpPacket int len; }; -std::ostream &operator<<(std::ostream &out, const struct sockaddr_in &addr) +//std::ostream &operator<<(std::ostream &out, const struct sockaddr_in &addr) +std::ostream &operator<<(std::ostream &out, struct sockaddr_in &addr) { out << "[" << inet_ntoa(addr.sin_addr) << ":"; out << htons(addr.sin_port) << "]"; diff --git a/libbitdht/src/udp/udplayer.h b/libbitdht/src/udp/udplayer.h index ab802e5da..8686940f1 100644 --- a/libbitdht/src/udp/udplayer.h +++ b/libbitdht/src/udp/udplayer.h @@ -33,7 +33,10 @@ #include #include -std::ostream &operator<<(std::ostream &out, const struct sockaddr_in &addr); +/* careful - duplicate definitions */ +//std::ostream &operator<<(std::ostream &out, const struct sockaddr_in &addr); +std::ostream &operator<<(std::ostream &out, struct sockaddr_in &addr); + bool operator==(const struct sockaddr_in &addr, const struct sockaddr_in &addr2); bool operator<(const struct sockaddr_in &addr, const struct sockaddr_in &addr2);