|
|
|
@ -161,7 +161,18 @@ void ThreadWaitExtIP()
@@ -161,7 +161,18 @@ void ThreadWaitExtIP()
|
|
|
|
|
settings.anonymous_mode = false; // (false => send peer_id, avoid connecting to itself)
|
|
|
|
|
ses->set_settings(settings); |
|
|
|
|
|
|
|
|
|
printf("libtorrent + dht started\n"); |
|
|
|
|
|
|
|
|
|
// wait up to 10 seconds for dht nodes to be set
|
|
|
|
|
for( int i = 0; i < 10; i++ ) { |
|
|
|
|
MilliSleep(1000); |
|
|
|
|
session_status ss = ses->status(); |
|
|
|
|
if( ss.dht_nodes ) |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
{ |
|
|
|
|
LOCK(cs_twister); |
|
|
|
|
boost::filesystem::path userDataPath = GetDataDir() / "user_data"; |
|
|
|
|
loadUserData(userDataPath.string(), m_users); |
|
|
|
|
printf("loaded user_data for %zd users\n", m_users.size()); |
|
|
|
@ -174,8 +185,7 @@ void ThreadWaitExtIP()
@@ -174,8 +185,7 @@ void ThreadWaitExtIP()
|
|
|
|
|
startTorrentUser(username); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
printf("libtorrent + dht started\n"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void ThreadMaintainDHTNodes() |
|
|
|
@ -183,7 +193,7 @@ void ThreadMaintainDHTNodes()
@@ -183,7 +193,7 @@ void ThreadMaintainDHTNodes()
|
|
|
|
|
RenameThread("maintain-dht-nodes"); |
|
|
|
|
|
|
|
|
|
while(1) { |
|
|
|
|
MilliSleep(15000); |
|
|
|
|
MilliSleep(5000); |
|
|
|
|
|
|
|
|
|
bool nodesAdded = false; |
|
|
|
|
if( ses ) { |
|
|
|
|