increase rate of connecting to fortuna stakes
@@ -1008,7 +1008,34 @@ void ThreadCheckForTunaPool(void* parg)
}
//if(c % (60*5) == 0){
- if(c % 60 == 0){
+ if(c % 60 == 0 && vecFortunastakes.size()) {
+ //let's connect to a random fortunastake every minute!
+ int fs = rand() % vecFortunastakes.size();
+ CService addr = vecFortunastakes[fs].addr;
+ if(ConnectNode((CAddress)addr, NULL, true)){
+ if (fDebug) printf("successfully connected to fortunastake at %s\n",addr.ToStringIPPort().c_str());
+ } else {
+ printf("error connecting to fortunastake at %s\n",addr.ToStringIPPort().c_str());
+ }
+
+
+ //if we're low on peers, let's connect to some random ipv4 fortunastakes. ipv6 probably won't route anyway
+ if (vNodes.size() < 25 && vecFortunastakes.size() > 25) {
+ int x = 25 - vNodes.size();
+ for (int i = x; i-- > 0; ) {
+ int fs = rand() % vecFortunastakes.size();
+ CService addr = vecFortunastakes[fs].addr;
+ if (addr.IsIPv4() && !addr.IsLocal()) {
+ if(ConnectNode((CAddress)addr, NULL, true)){
+ if (fDebug) printf("successfully connected to fortunastake at %s\n",addr.ToStringIPPort().c_str());
+ } else {
+ printf("error connecting to fortunastake at %s\n",addr.ToStringIPPort().c_str());
+ }
+ }
+ //MilliSleep(250); // 250 msecs * 50 nodes = 42.5sec, just in time to run this again if needed!
+ }
+
+ }
//if we've used 1/5 of the fortunastake list, then clear the list.
if((int)vecFortunastakesUsed.size() > (int)vecFortunastakes.size() / 5)
vecFortunastakesUsed.clear();
