mirror of
https://github.com/savoirfairelinux/opendht.git
synced 2026-11-08 04:21:51 +00:00
dht: print detailed request state in search log
This commit is contained in:
1 parent
68f52a815d
commit
63db2eafd9
2 files changed
+10
-4
No files matched your search
+1
-4
@@ -1540,10 +1540,7 @@ Dht::dumpSearch(const Search& sr, std::ostream& out) const
|
||||
if (ack == n.acked.end() or not ack->second.first) {
|
||||
out << ' ';
|
||||
} else {
|
||||
if (ack->second.first->completed())
|
||||
out << 'a';
|
||||
else if (ack->second.first->pending())
|
||||
out << 'f';
|
||||
out << ack->second.first->getStateChar();
|
||||
}
|
||||
}
|
||||
out << "] ";
|
||||
|
||||
@@ -57,6 +57,15 @@ struct Request {
|
||||
bool pending() const { return state_ == State::PENDING; }
|
||||
bool over() const { return not pending(); }
|
||||
State getState() const { return state_; }
|
||||
char getStateChar() const {
|
||||
switch (state_) {
|
||||
case State::PENDING: return 'f';
|
||||
case State::CANCELLED: return 'c';
|
||||
case State::EXPIRED: return 'e';
|
||||
case State::COMPLETED: return 'a';
|
||||
default: return '?';
|
||||
}
|
||||
}
|
||||
|
||||
Request(State state = State::PENDING) : state_(state) {}
|
||||
Request(MessageType type, Tid tid,
|
||||
|
||||
Reference in new issue
Block a user