fixed incoming peer source flag and exposed it in client_test

This commit is contained in:
Arvid Norberg 2009-05-15 23:22:11 +00:00
parent 87eb945811
commit 5bce212126
2 changed files with 5 additions and 3 deletions

View File

@ -335,7 +335,7 @@ void print_peer_info(std::string& out, std::vector<libtorrent::peer_info> const&
#ifndef TORRENT_DISABLE_GEO_IP #ifndef TORRENT_DISABLE_GEO_IP
if (print_as) out += "AS "; if (print_as) out += "AS ";
#endif #endif
out += "down (total | peak ) up (total | peak ) sent-req recv flags source "; out += "down (total | peak ) up (total | peak ) sent-req recv flags source ";
if (print_fails) out += "fail hshf "; if (print_fails) out += "fail hshf ";
if (print_send_bufs) out += "rq sndb quota rcvb q-bytes "; if (print_send_bufs) out += "rq sndb quota rcvb q-bytes ";
if (print_timers) out += "inactive wait timeout q-time "; if (print_timers) out += "inactive wait timeout q-time ";
@ -371,7 +371,7 @@ void print_peer_info(std::string& out, std::vector<libtorrent::peer_info> const&
#endif #endif
snprintf(str, sizeof(str) snprintf(str, sizeof(str)
, "%s%s (%s|%s) %s%s (%s|%s) %s%3d (%3d) %3d %c%c%c%c%c%c%c%c%c%c%c%c%c%c %c%c%c%c%c " , "%s%s (%s|%s) %s%s (%s|%s) %s%3d (%3d) %3d %c%c%c%c%c%c%c%c%c%c%c%c%c%c %c%c%c%c%c%c "
, esc("32"), add_suffix(i->down_speed, "/s").c_str() , esc("32"), add_suffix(i->down_speed, "/s").c_str()
, add_suffix(i->total_download).c_str(), add_suffix(i->download_rate_peak, "/s").c_str() , add_suffix(i->total_download).c_str(), add_suffix(i->download_rate_peak, "/s").c_str()
, esc("31"), add_suffix(i->up_speed, "/s").c_str(), add_suffix(i->total_upload).c_str() , esc("31"), add_suffix(i->up_speed, "/s").c_str(), add_suffix(i->total_upload).c_str()
@ -406,7 +406,8 @@ void print_peer_info(std::string& out, std::vector<libtorrent::peer_info> const&
, (i->source & peer_info::pex)?'P':'_' , (i->source & peer_info::pex)?'P':'_'
, (i->source & peer_info::dht)?'D':'_' , (i->source & peer_info::dht)?'D':'_'
, (i->source & peer_info::lsd)?'L':'_' , (i->source & peer_info::lsd)?'L':'_'
, (i->source & peer_info::resume_data)?'R':'_'); , (i->source & peer_info::resume_data)?'R':'_'
, (i->source & peer_info::incoming)?'I':'_');
out += str; out += str;
if (print_fails) if (print_fails)

View File

@ -799,6 +799,7 @@ namespace libtorrent
#endif #endif
i->inet_as = ses.lookup_as(as); i->inet_as = ses.lookup_as(as);
#endif #endif
i->source = peer_info::incoming;
} }
TORRENT_ASSERT(i); TORRENT_ASSERT(i);