mirror of
https://github.com/twisterarmy/twister-core.git
synced 2025-09-12 22:31:52 +00:00
delay torrent initialization
This commit is contained in:
parent
08cadbb78e
commit
0b906f2494
@ -8,7 +8,7 @@
|
|||||||
// These need to be macros, as version.cpp's and bitcoin-qt.rc's voodoo requires it
|
// These need to be macros, as version.cpp's and bitcoin-qt.rc's voodoo requires it
|
||||||
#define CLIENT_VERSION_MAJOR 0
|
#define CLIENT_VERSION_MAJOR 0
|
||||||
#define CLIENT_VERSION_MINOR 9
|
#define CLIENT_VERSION_MINOR 9
|
||||||
#define CLIENT_VERSION_REVISION 9
|
#define CLIENT_VERSION_REVISION 10
|
||||||
#define CLIENT_VERSION_BUILD 0
|
#define CLIENT_VERSION_BUILD 0
|
||||||
|
|
||||||
// Set to true for release, false for prerelease or test build
|
// Set to true for release, false for prerelease or test build
|
||||||
|
@ -481,7 +481,8 @@ void ThreadMaintainDHTNodes()
|
|||||||
|
|
||||||
void ThreadSessionAlerts()
|
void ThreadSessionAlerts()
|
||||||
{
|
{
|
||||||
static map<sha1_hash, entry> neighborCheck;
|
static map<sha1_hash, bool> neighborCheck;
|
||||||
|
static map<sha1_hash, bool> statusCheck;
|
||||||
|
|
||||||
while(!ses) {
|
while(!ses) {
|
||||||
MilliSleep(200);
|
MilliSleep(200);
|
||||||
@ -563,14 +564,22 @@ void ThreadSessionAlerts()
|
|||||||
LOCK(cs_twister);
|
LOCK(cs_twister);
|
||||||
knownTorrent = m_userTorrent.count(n->string());
|
knownTorrent = m_userTorrent.count(n->string());
|
||||||
}
|
}
|
||||||
if( !neighborCheck.count(ih) && !knownTorrent ) {
|
if( !knownTorrent ) {
|
||||||
|
if( !neighborCheck.count(ih) ) {
|
||||||
printf("possiblyNeighbor of [%s,%s,%s] - starting a new dhtget to be sure\n",
|
printf("possiblyNeighbor of [%s,%s,%s] - starting a new dhtget to be sure\n",
|
||||||
n->string().c_str(),
|
n->string().c_str(),
|
||||||
r->string().c_str(),
|
r->string().c_str(),
|
||||||
t->string().c_str());
|
t->string().c_str());
|
||||||
|
|
||||||
neighborCheck[ih] = gd->m_target;
|
neighborCheck[ih] = false;
|
||||||
ses->dht_getData(n->string(), r->string(), t->string() == "m");
|
ses->dht_getData(n->string(), r->string(), t->string() == "m");
|
||||||
|
} else if( neighborCheck[ih] ) {
|
||||||
|
printf("known neighbor. starting a new dhtget check of [%s,%s,%s]\n",
|
||||||
|
n->string().c_str(), "status", "s");
|
||||||
|
sha1_hash ihStatus = dhtTargetHash(n->string(), "status", "s");
|
||||||
|
statusCheck[ihStatus] = false;
|
||||||
|
ses->dht_getData(n->string(), "status", false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -599,13 +608,20 @@ void ThreadSessionAlerts()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( dd->m_is_neighbor && m_specialResources.count(dd->m_resource) &&
|
if( neighborCheck.count(ih) ) {
|
||||||
neighborCheck.count(ih) ) {
|
neighborCheck[ih] = dd->m_is_neighbor;
|
||||||
// Do something!
|
if( dd->m_is_neighbor && dd->m_resource == "tracker" ) {
|
||||||
if( dd->m_resource == "tracker" ) {
|
printf("is neighbor. starting a new dhtget check of [%s,%s,%s]\n",
|
||||||
|
dd->m_username.c_str(), "status", "s");
|
||||||
|
sha1_hash ihStatus = dhtTargetHash(dd->m_username, "status", "s");
|
||||||
|
statusCheck[ihStatus] = false;
|
||||||
|
ses->dht_getData(dd->m_username, "status", false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if( statusCheck.count(ih) ) {
|
||||||
|
statusCheck[ih] = dd->m_got_data;
|
||||||
|
if( dd->m_got_data ) {
|
||||||
startTorrentUser(dd->m_username, false);
|
startTorrentUser(dd->m_username, false);
|
||||||
} else {
|
|
||||||
printf("Neighbor of special resource - do something!\n");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user