Skip to content

Commit

Permalink
minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
vshymanskyy committed Oct 13, 2012
1 parent 3e43529 commit e14f25b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
1 change: 0 additions & 1 deletion bsp.cfg
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
vshymanskyy.org.ua:7777
localhost:7777
2 changes: 2 additions & 0 deletions src/KadContact.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ struct KadContact
return free(ptr);
}
*/

bool IsStale() const { return mFailQty >= KADEMLIA_STALE; }
bool BecameStale() const { return mFailQty == KADEMLIA_STALE; }
};

typedef std::tr1::shared_ptr<KadContact> KadContactPtr;
Expand Down
7 changes: 4 additions & 3 deletions src/KadOpMgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

#include "KadMsg.h"
#include "KadOverIP.h"
#include "KadIterativeFind.h"

#include <iostream>
#include <map>
Expand Down Expand Up @@ -84,7 +83,7 @@ class KadOpMgr {

void Start() {
int sentQty = Send(KADEMLIA_ALPHA);
LOG(mMgr->mLog, FMT("Started node lookup: %d sent", sentQty));
LOG_DEEP(mMgr->mLog, FMT("Started node lookup: %d sent", sentQty));
}

void OnResponce(const msgpack::object* rsp, KadContactPtr& contact) {
Expand All @@ -98,7 +97,9 @@ class KadOpMgr {

if (!rsp) {
if (contact->IsStale()) {
LOG(mMgr->mLog, "Stale: " << contact->mAddrExt.ToString());
if (contact->BecameStale()) {
LOG(mMgr->mLog, "Stale: " << contact->mAddrExt.ToString());
}

KadContactList::It n = mList.FindAfter(mList.First(), contact);
if (n != mList.End()) {
Expand Down
10 changes: 5 additions & 5 deletions src/KadRtNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -255,15 +255,15 @@ class TKadRtNode
}

void PrintDot(std::ostream& s) const {
TKadId<KadId::SIZE+1> rangeSize = TKadId<KadId::SIZE+1>::PowerOfTwo(KadId::BIT_SIZE-mDepth);
//TKadId<KadId::SIZE> rangeSize = TKadId<KadId::SIZE>::PowerOfTwo(KadId::BIT_SIZE-mDepth);

if (IsBucket()) {
s << '"' << this << '"';
s << " [shape=record, style=filled, fillcolor=skyblue, label=\"{";
s << "{index:" << mIndex << "|depth:" << mDepth << "}";

s << "|{size:" << rangeSize.ToString() << "}";
s << "|{[" << (rangeSize*mIndex).ToString() << "; " << (rangeSize*(mIndex+1)).ToString() << ")}";
//s << "|{size:" << rangeSize.ToString() << "}";
//s << "|{[" << (rangeSize*mIndex).ToString() << "; " << (rangeSize*(mIndex+1)).ToString() << ")}";

s << "|{Contacts (" << mContacts.Count() << ")}";
for (KadContactList::It it = mContacts.First(); it != mContacts.End(); ++it) {
Expand All @@ -281,8 +281,8 @@ class TKadRtNode
s << "{index:" << mIndex << "|depth:" << mDepth << "}";

s << "|{local:" << mLocalId.ToString() << "}";
s << "|{size:" << rangeSize.ToString() << "}";
s << "|{[" << (rangeSize*mIndex).ToString() << "; " << (rangeSize*(mIndex+1)).ToString() << ")}";
//s << "|{size:" << rangeSize.ToString() << "}";
//s << "|{[" << (rangeSize*mIndex).ToString() << "; " << (rangeSize*(mIndex+1)).ToString() << ")}";

s << "}\"]" << std::endl;

Expand Down

0 comments on commit e14f25b

Please sign in to comment.