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,27 +871,29 @@ 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}",
"download_speed", float(peers[i].down_speed),
"total_download", double(peers[i].total_download),
"upload_speed", float(peers[i].up_speed),
"total_upload", double(peers[i].total_upload),
"download_queue_length", long(peers[i].download_queue_length),
"upload_queue_length", long(peers[i].upload_queue_length),
"is_interesting", long((peers[i].flags & peer_info::interesting) != 0),
"is_choked", long((peers[i].flags & peer_info::choked) != 0),
"is_remote_interested", long((peers[i].flags & peer_info::remote_interested) != 0),
"is_remote_choked", long((peers[i].flags & peer_info::remote_choked) != 0),
"supports_extensions", long((peers[i].flags & peer_info::supports_extensions)!= 0),
"is_local_connection", long((peers[i].flags & peer_info::local_connection) != 0),
"is_awaiting_handshake", long((peers[i].flags & peer_info::handshake) != 0),
"is_connecting", long((peers[i].flags & peer_info::connecting) != 0),
"is_queued", long((peers[i].flags & peer_info::queued) != 0),
"client", peers[i].client.c_str(),
"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
"{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),
"total_upload", double(peers[i].total_upload),
"download_queue_length", long(peers[i].download_queue_length),
"upload_queue_length", long(peers[i].upload_queue_length),
"is_interesting", long((peers[i].flags & peer_info::interesting) != 0),
"is_choked", long((peers[i].flags & peer_info::choked) != 0),
"is_remote_interested", long((peers[i].flags & peer_info::remote_interested) != 0),
"is_remote_choked", long((peers[i].flags & peer_info::remote_choked) != 0),
"supports_extensions", long((peers[i].flags & peer_info::supports_extensions)!= 0),
"is_local_connection", long((peers[i].flags & peer_info::local_connection) != 0),
"is_awaiting_handshake", long((peers[i].flags & peer_info::handshake) != 0),
"is_connecting", long((peers[i].flags & peer_info::connecting) != 0),
"is_queued", long((peers[i].flags & peer_info::queued) != 0),
"client", peers[i].client.c_str(),
"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,
"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