diff --git a/src/deluge_core.cpp b/src/deluge_core.cpp index 58fc0ef0b..f9d4f85df 100644 --- a/src/deluge_core.cpp +++ b/src/deluge_core.cpp @@ -567,13 +567,13 @@ static PyObject *torrent_pause(PyObject *self, PyObject *args) python_long unique_ID; if (!PyArg_ParseTuple(args, "i", &unique_ID)) return NULL; - + long index = get_index_from_unique_ID(unique_ID); if (PyErr_Occurred()) return NULL; M_torrents->at(index).handle.pause(); - + Py_INCREF(Py_None); return Py_None; } @@ -613,11 +613,20 @@ static PyObject *torrent_get_torrent_state(PyObject *self, PyObject *args) long connected_seeds = 0; long connected_peers = 0; + long total_seeds = 0; + long total_peers = 0; + 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))) connected_seeds++; + if (!(peers[i].flags&(peer_info::handshake|peer_info::connecting|peer_info::queued|peer_info::seed))) 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}", @@ -643,8 +652,10 @@ static PyObject *torrent_get_torrent_state(PyObject *self, PyObject *args) "total_size", i.total_size(), "piece_length", i.piece_length(), "num_pieces", i.num_pieces(), - "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_peers", long(s.num_incomplete != -1? s.num_incomplete : connected_peers), +// "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_seed", t.handle.is_seed(), "total_done", s.total_done,