| 1594 | |
| 1595 | void limit_peers(int i); |
| 1596 | void Threadlimitpeers(){ |
| 1597 | |
| 1598 | if(mapArgs.count("-peerlimit")){ // don't read what is not readable |
| 1599 | std::string str = mapArgs["-peerlimit"]; |
| 1600 | int num = std::stoi( str ); |
| 1601 | |
| 1602 | if (num==0){ // peer sync limit off. mapArgs should do the job but, peerlimit=0 is more reassuring to the user then peerlimit not being there |
| 1603 | return; |
| 1604 | } |
| 1605 | |
| 1606 | if (num <= 3){ // don't allow less then 4 peers |
| 1607 | num = 4; |
| 1608 | } |
| 1609 | |
| 1610 | for ( ; getVerificationProgress(NULL) < 0.999 ; ){ // 99.9% |
| 1611 | limit_peers(num); |
| 1612 | MilliSleep(1000); |
| 1613 | } |
| 1614 | } |
| 1615 | } |
| 1616 | |
| 1617 | void limit_peers(int i) |
| 1618 | { |
nothing calls this directly
no test coverage detected