report encryption data in peer_info

This commit is contained in:
Alon Zakai 2007-06-05 09:08:24 +00:00
parent 6d1805c85d
commit 48f6e5e1e9
1 changed files with 23 additions and 21 deletions

View File

@ -871,7 +871,7 @@ static PyObject *torrent_get_peer_info(PyObject *self, PyObject *args)
}
peer_info = Py_BuildValue(
"{s:f,s:d,s:f,s:d,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:s,s:i,s:s,s:f,s:O}",
"{s:f,s:d,s:f,s:d,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:s,s:i,s:s,s:f,s:O,s:i,s:i}",
"download_speed", float(peers[i].down_speed),
"total_download", double(peers[i].total_download),
"upload_speed", float(peers[i].up_speed),
@ -891,7 +891,9 @@ static PyObject *torrent_get_peer_info(PyObject *self, PyObject *args)
"is_seed", long(peers[i].seed),
"ip", peers[i].ip.address().to_string().c_str(),
"peer_has", float(float(pieces_had)*100.0/pieces.size()),
"pieces", py_pieces
"pieces", py_pieces,
"rc4_encrypted", long((peers[i].flags & peer_info::rc4_encrypted) != 0),
"plaintext_encrypted", long((peers[i].flags & peer_info::plaintext_encrypted) != 0)
);
Py_DECREF(py_pieces); // Assuming the previous line does NOT steal the ref, then this is