more fixes for the peers/seeds display..
This commit is contained in:
parent
9bd479160f
commit
e77a3318da
|
@ -613,11 +613,20 @@ static PyObject *torrent_get_torrent_state(PyObject *self, PyObject *args)
|
||||||
|
|
||||||
long connected_seeds = 0;
|
long connected_seeds = 0;
|
||||||
long connected_peers = 0;
|
long connected_peers = 0;
|
||||||
|
long total_seeds = 0;
|
||||||
|
long total_peers = 0;
|
||||||
|
|
||||||
for (unsigned long i = 0; i < peers.size(); i++) {
|
for (unsigned long i = 0; i < peers.size(); i++) {
|
||||||
if ((peers[i].flags&(peer_info::seed)) && !(peers[i].flags&(peer_info::handshake|peer_info::connecting|peer_info::queued)))
|
if ((peers[i].flags&(peer_info::seed)) && !(peers[i].flags&(peer_info::handshake|peer_info::connecting|peer_info::queued)))
|
||||||
connected_seeds++;
|
connected_seeds++;
|
||||||
|
|
||||||
if (!(peers[i].flags&(peer_info::handshake|peer_info::connecting|peer_info::queued|peer_info::seed)))
|
if (!(peers[i].flags&(peer_info::handshake|peer_info::connecting|peer_info::queued|peer_info::seed)))
|
||||||
connected_peers++;
|
connected_peers++;
|
||||||
|
|
||||||
|
if ((peers[i].flags&(peer_info::seed)))
|
||||||
|
total_seeds++;
|
||||||
|
else
|
||||||
|
total_peers++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Py_BuildValue("{s:s,s:i,s:i,s:l,s:l,s:f,s:f,s:f,s:L,s:L,s:b,s:s,s:s,s:f,s:L,s:L,s:l,s:i,s:i,s:L,s:L,s:i,s:l,s:l,s:b,s:b,s:L,s:L,s:L}",
|
return Py_BuildValue("{s:s,s:i,s:i,s:l,s:l,s:f,s:f,s:f,s:L,s:L,s:b,s:s,s:s,s:f,s:L,s:L,s:l,s:i,s:i,s:L,s:L,s:i,s:l,s:l,s:b,s:b,s:L,s:L,s:L}",
|
||||||
|
@ -643,8 +652,10 @@ static PyObject *torrent_get_torrent_state(PyObject *self, PyObject *args)
|
||||||
"total_size", i.total_size(),
|
"total_size", i.total_size(),
|
||||||
"piece_length", i.piece_length(),
|
"piece_length", i.piece_length(),
|
||||||
"num_pieces", i.num_pieces(),
|
"num_pieces", i.num_pieces(),
|
||||||
"total_peers", long(s.num_incomplete != -1? s.num_incomplete : connected_peers),
|
// "total_peers", long(s.num_incomplete != -1? s.num_incomplete : connected_peers),
|
||||||
"total_seeds", long(s.num_complete != -1? s.num_complete : connected_seeds),
|
// "total_seeds", long(s.num_complete != -1? s.num_complete : connected_seeds),
|
||||||
|
"total_peers", total_peers,
|
||||||
|
"total_seeds", total_seeds,
|
||||||
"is_paused", t.handle.is_paused(),
|
"is_paused", t.handle.is_paused(),
|
||||||
"is_seed", t.handle.is_seed(),
|
"is_seed", t.handle.is_seed(),
|
||||||
"total_done", s.total_done,
|
"total_done", s.total_done,
|
||||||
|
|
Loading…
Reference in New Issue