mirror of
https://github.com/codex-storage/deluge.git
synced 2025-02-06 08:33:56 +00:00
add peer_blocked_alert
This commit is contained in:
parent
b40d54cd10
commit
b7b31804c1
@ -86,6 +86,7 @@ using namespace libtorrent;
|
||||
#define EVENT_PIECE_FINISHED 15
|
||||
#define EVENT_BLOCK_DOWNLOADING 16
|
||||
#define EVENT_BLOCK_FINISHED 17
|
||||
#define EVENT_PEER_BLOCKED 18
|
||||
|
||||
#define STATE_QUEUED 0
|
||||
#define STATE_CHECKING 1
|
||||
@ -376,7 +377,7 @@ static PyObject *torrent_init(PyObject *self, PyObject *args)
|
||||
|
||||
M_ses->add_extension(&libtorrent::create_metadata_plugin);
|
||||
|
||||
M_constants = Py_BuildValue("{s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i}",
|
||||
M_constants = Py_BuildValue("{s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i}",
|
||||
"EVENT_NULL", EVENT_NULL,
|
||||
"EVENT_FINISHED", EVENT_FINISHED,
|
||||
"EVENT_PEER_ERROR", EVENT_PEER_ERROR,
|
||||
@ -394,6 +395,7 @@ static PyObject *torrent_init(PyObject *self, PyObject *args)
|
||||
"EVENT_PIECE_FINISHED", EVENT_PIECE_FINISHED,
|
||||
"EVENT_BLOCK_DOWNLOADING", EVENT_BLOCK_DOWNLOADING,
|
||||
"EVENT_BLOCK_FINISHED", EVENT_BLOCK_FINISHED,
|
||||
"EVENT_PEER_BLOCKED", EVENT_PEER_BLOCKED,
|
||||
"STATE_QUEUED", STATE_QUEUED,
|
||||
"STATE_CHECKING", STATE_CHECKING,
|
||||
"STATE_CONNECTING", STATE_CONNECTING,
|
||||
@ -1111,6 +1113,21 @@ static PyObject *torrent_pop_event(PyObject *self, PyObject *args)
|
||||
"message", a->msg().c_str());
|
||||
else
|
||||
{ Py_INCREF(Py_None); return Py_None; }
|
||||
} else if (dynamic_cast<peer_blocked_alert*>(popped_alert))
|
||||
{
|
||||
torrent_handle handle = (dynamic_cast<peer_blocked_alert*>(popped_alert))->handle;
|
||||
long index = get_torrent_index(handle);
|
||||
if (PyErr_Occurred())
|
||||
return NULL;
|
||||
|
||||
if (handle_exists(handle))
|
||||
return Py_BuildValue("{s:i,s:i,s:i,s:s}",
|
||||
"event_type", EVENT_PEER_BLOCKED,
|
||||
"unique_ID", M_torrents->at(index).unique_ID,
|
||||
"peer_ip", ip,
|
||||
"message", a->msg().c_str());
|
||||
else
|
||||
{ Py_INCREF(Py_None); return Py_None; }
|
||||
} else if (dynamic_cast<tracker_warning_alert*>(popped_alert))
|
||||
{
|
||||
torrent_handle handle = (dynamic_cast<tracker_warning_alert*>(popped_alert))->handle;
|
||||
|
Loading…
x
Reference in New Issue
Block a user