@@ -243,6 +243,7 @@ void P2P::ListenerThread(int update_interval)
243
243
std::string totalMessage = " " ;
244
244
std::map<int , std::string> messageParts = std::map<int , std::string>();
245
245
int maxSegments = 0 ;
246
+ uint32_t noreceipt = 0 ; // A counter that increments each time tick there is no message
246
247
247
248
while (!stop_thread_1)
248
249
{
@@ -263,6 +264,8 @@ void P2P::ListenerThread(int update_interval)
263
264
264
265
if (iResult > 0 ) {
265
266
267
+ noreceipt = 0 ;
268
+
266
269
// Get the IPV4 address:port pair of the received data. If it
267
270
// matches the expected one, continue. If it does not, then
268
271
// stop. If the current one is blank or has disconnected,
@@ -277,7 +280,7 @@ void P2P::ListenerThread(int update_interval)
277
280
p2pConnections[fromIPString]->life = 0 ;
278
281
279
282
// If not currently connected, accept this connection.
280
- if (( otherAddrStr == " " || otherAddrStr == " 0.0.0.0:0" ) && otherAddrStr != clientIPPort ){
283
+ if (otherAddrStr == " " || otherAddrStr == " 0.0.0.0:0" ){
281
284
if (WalletSettingValues::verbose >= 4 )
282
285
console::WriteLine (" \n Conversation Started" , console::greenFGColor, " " );
283
286
@@ -587,6 +590,17 @@ void P2P::ListenerThread(int update_interval)
587
590
588
591
}
589
592
}
593
+ else if (noreceipt >= 100 ){
594
+ if (WalletSettingValues::verbose >= 4 && otherAddrStr != " " )
595
+ console::WriteLine (" noreceipt timeout check" );
596
+ messageStatus = idle;
597
+ messageAttempt = 0 ;
598
+ otherAddrStr = " " ;
599
+ noreceipt = 0 ;
600
+ }
601
+ else {
602
+ noreceipt++;
603
+ }
590
604
#if WINDOWS
591
605
else if (WSAGetLastError () != WSAETIMEDOUT && WalletSettingValues::verbose >= 5 ) {
592
606
console::NetworkErrorPrint ();
@@ -1092,13 +1106,15 @@ void P2P::SenderThread()
1092
1106
console::NetworkErrorPrint ();
1093
1107
console::WriteLine (" !! No peers seem to be online. Please try again later. !!" , console::redFGColor, " " );
1094
1108
differentPeerAttempts = 0 ;
1109
+ otherAddrStr = " " ;
1095
1110
reqDat = -1 ;
1096
1111
}
1097
1112
}
1098
1113
// Otherwise, this is the answerer, so stop trying to reply to the original asker.
1099
1114
else {
1100
1115
role = -1 ;
1101
1116
messageStatus = idle;
1117
+ otherAddrStr = " " ;
1102
1118
if (WalletSettingValues::verbose >= 5 ){
1103
1119
console::NetworkErrorPrint ();
1104
1120
console::WriteLine (" Asking peer went offline." , console::redFGColor, " " );
0 commit comments