diff --git a/libtorrent/src/policy.cpp b/libtorrent/src/policy.cpp index dff860bd2..c337d2456 100755 --- a/libtorrent/src/policy.cpp +++ b/libtorrent/src/policy.cpp @@ -1045,10 +1045,10 @@ namespace libtorrent // we don't have any info about this peer. // add a new entry - peer p(remote, peer::connectable, src); - i = m_peers.insert(std::make_pair(remote.address(), p)); + i = m_peers.insert(std::make_pair(remote.address() + , peer(remote, peer::connectable, src))); #ifndef TORRENT_DISABLE_ENCRYPTION - if (flags & 0x01) p.pe_support = true; + if (flags & 0x01) i->second.pe_support = true; #endif if (flags & 0x02) i->second.seed = true; diff --git a/src/core.py b/src/core.py index 7f5538cfa..1c3cf1c01 100644 --- a/src/core.py +++ b/src/core.py @@ -653,6 +653,9 @@ class Manager: self.set_supp_torrent_state_val(event['unique_ID'], "tracker_status", _("Announce sent")) + elif event['event_type'] is self.constants['EVENT_LISTEN_FAILED']: + deluge_core.set_listen_on(self.get_state()['port'], + self.get_state()['port']) elif event['event_type'] is self.constants['EVENT_TRACKER_REPLY']: self.set_supp_torrent_state_val(event['unique_ID'], "tracker_status", diff --git a/src/deluge_core.cpp b/src/deluge_core.cpp index 8b2b52c7d..8133c7e1c 100644 --- a/src/deluge_core.cpp +++ b/src/deluge_core.cpp @@ -91,6 +91,7 @@ using namespace libtorrent; #define EVENT_BLOCK_DOWNLOADING 16 #define EVENT_BLOCK_FINISHED 17 #define EVENT_PEER_BLOCKED 18 +#define EVENT_LISTEN_FAILED 19 #define STATE_QUEUED 0 #define STATE_CHECKING 1 @@ -383,7 +384,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, @@ -402,6 +403,7 @@ static PyObject *torrent_init(PyObject *self, PyObject *args) "EVENT_BLOCK_DOWNLOADING", EVENT_BLOCK_DOWNLOADING, "EVENT_BLOCK_FINISHED", EVENT_BLOCK_FINISHED, "EVENT_PEER_BLOCKED", EVENT_PEER_BLOCKED, + "EVENT_LISTEN_FAILED", EVENT_LISTEN_FAILED, "STATE_QUEUED", STATE_QUEUED, "STATE_CHECKING", STATE_CHECKING, "STATE_CONNECTING", STATE_CONNECTING, @@ -944,6 +946,11 @@ static PyObject *torrent_pop_event(PyObject *self, PyObject *args) "event_type", EVENT_PEER_BLOCKED, "ip", peer_IP.c_str(), "message", a->msg().c_str()); + } else if (dynamic_cast(popped_alert)) + { + return Py_BuildValue("{s:i,s:s}", + "event_type", EVENT_LISTEN_FAILED, + "message", a->msg().c_str()); } else if (dynamic_cast(popped_alert)) { torrent_handle handle = (dynamic_cast(popped_alert))->handle;