forked from premiere/premiere-libtorrent
no need to close and re-open the listen socket when starting the DHT. Report the actual port we ended up listening on if the system chose one. don't try to listen on i2p
This commit is contained in:
parent
9ecfbd17e6
commit
5431d86779
|
@ -1152,7 +1152,7 @@ int main(int argc, char* argv[])
|
||||||
|
|
||||||
ses.set_proxy(ps);
|
ses.set_proxy(ps);
|
||||||
|
|
||||||
ses.listen_on(std::make_pair(listen_port, listen_port + 10)
|
ses.listen_on(std::make_pair(listen_port, listen_port)
|
||||||
, ec, bind_to_interface.c_str());
|
, ec, bind_to_interface.c_str());
|
||||||
if (ec)
|
if (ec)
|
||||||
{
|
{
|
||||||
|
|
|
@ -91,6 +91,8 @@ namespace libtorrent
|
||||||
m_sam_router = s;
|
m_sam_router = s;
|
||||||
m_sam_router.type = proxy_settings::i2p_proxy;
|
m_sam_router.type = proxy_settings::i2p_proxy;
|
||||||
|
|
||||||
|
if (m_sam_router.hostname.empty()) return;
|
||||||
|
|
||||||
m_state = sam_connecting;
|
m_state = sam_connecting;
|
||||||
|
|
||||||
char tmp[20];
|
char tmp[20];
|
||||||
|
|
|
@ -1779,6 +1779,11 @@ namespace aux {
|
||||||
return listen_socket_t();
|
return listen_socket_t();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if we asked the system to listen on port 0, which
|
||||||
|
// socket did it end up choosing?
|
||||||
|
if (ep.port() == 0)
|
||||||
|
ep.port(s.sock->local_endpoint().port());
|
||||||
|
|
||||||
if (m_alerts.should_post<listen_succeeded_alert>())
|
if (m_alerts.should_post<listen_succeeded_alert>())
|
||||||
m_alerts.post_alert(listen_succeeded_alert(ep));
|
m_alerts.post_alert(listen_succeeded_alert(ep));
|
||||||
|
|
||||||
|
@ -4365,12 +4370,6 @@ namespace aux {
|
||||||
{
|
{
|
||||||
INVARIANT_CHECK;
|
INVARIANT_CHECK;
|
||||||
|
|
||||||
if (m_listen_interface.port() != 0)
|
|
||||||
{
|
|
||||||
error_code ec;
|
|
||||||
open_listen_port(0, ec);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_dht)
|
if (m_dht)
|
||||||
{
|
{
|
||||||
m_dht->stop();
|
m_dht->stop();
|
||||||
|
|
Loading…
Reference in New Issue