From 915f5d5f3fbfdbdc3b34e273c42f31e65965dff8 Mon Sep 17 00:00:00 2001 From: rswindell <> Date: Tue, 21 Jan 2003 20:44:34 +0000 Subject: [PATCH] Added retry loop (up to 60 times) for socket sends to remote server, this fixes problem with non-blocking socket returning EWOULDBLOCK. --- src/sbbs3/telgate.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/sbbs3/telgate.cpp b/src/sbbs3/telgate.cpp index faa15373ad..41640041b4 100644 --- a/src/sbbs3/telgate.cpp +++ b/src/sbbs3/telgate.cpp @@ -44,6 +44,7 @@ void sbbs_t::telnet_gate(char* destaddr, ulong mode) uchar buf[512]; int i; int rd; + uint attempts; ulong l; bool gotline; ushort port; @@ -193,7 +194,15 @@ void sbbs_t::telnet_gate(char* destaddr, ulong mode) sem_post(&output_sem); } } - if((i=sendsocket(remote_socket,(char*)buf,rd))<0) { + for(attempts=0;attempts<60 && online; attempts++) /* added retry loop here, Jan-20-2003 */ + { + if((i=sendsocket(remote_socket,(char*)buf,rd))>=0) + break; + if(ERROR_VALUE!=EWOULDBLOCK) + break; + mswait(500); + } + if(i<0) { lprintf("!TELGATE ERROR %d sending on socket %d",ERROR_VALUE,remote_socket); break; } -- GitLab