mirror of
https://git.deluge-torrent.org/deluge
synced 2025-04-20 19:44:52 +00:00
hopefully fix 'losing' port in windows
This commit is contained in:
parent
3a23ad301a
commit
370578119e
3 changed files with 14 additions and 4 deletions
|
@ -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;
|
||||
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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<listen_failed_alert*>(popped_alert))
|
||||
{
|
||||
return Py_BuildValue("{s:i,s:s}",
|
||||
"event_type", EVENT_LISTEN_FAILED,
|
||||
"message", a->msg().c_str());
|
||||
} else if (dynamic_cast<block_downloading_alert*>(popped_alert))
|
||||
{
|
||||
torrent_handle handle = (dynamic_cast<block_downloading_alert*>(popped_alert))->handle;
|
||||
|
|
Loading…
Add table
Reference in a new issue