Skip to content
Snippets Groups Projects
Commit ac8d87b6 authored by rswindell's avatar rswindell
Browse files

Some more beautification and debug logging in send_byte().

parent 9202c5c4
No related branches found
No related tags found
No related merge requests found
...@@ -402,6 +402,7 @@ int send_byte(void* unused, uchar ch, unsigned timeout) ...@@ -402,6 +402,7 @@ int send_byte(void* unused, uchar ch, unsigned timeout)
{ {
uchar buf[2] = { TELNET_IAC, TELNET_IAC }; uchar buf[2] = { TELNET_IAC, TELNET_IAC };
unsigned len=1; unsigned len=1;
DWORD result;
if(telnet && ch==TELNET_IAC) /* escape IAC char */ if(telnet && ch==TELNET_IAC) /* escape IAC char */
len=2; len=2;
...@@ -411,14 +412,15 @@ int send_byte(void* unused, uchar ch, unsigned timeout) ...@@ -411,14 +412,15 @@ int send_byte(void* unused, uchar ch, unsigned timeout)
if(RingBufFree(&outbuf)<len) { if(RingBufFree(&outbuf)<len) {
fprintf(statfp,"FLOW"); fprintf(statfp,"FLOW");
flows++; flows++;
if(WaitForEvent(outbuf_empty,timeout*1000)!=WAIT_OBJECT_0) { result=WaitForEvent(outbuf_empty,timeout*1000);
fprintf(statfp,"\b\b\b\b \b\b\b\b");
if(result!=WAIT_OBJECT_0) {
fprintf(statfp fprintf(statfp
,"\n!TIMEOUT waiting for output buffer to flush (%u seconds, %u bytes)\n" ,"\n!TIMEOUT (%d) waiting for output buffer to flush (%u seconds, %u bytes)\n"
,timeout, RingBufFull(&outbuf)); ,result, timeout, RingBufFull(&outbuf));
newline=TRUE; newline=TRUE;
return(-1); return(-1);
} }
fprintf(statfp,"\b\b\b\b \b\b\b\b");
} }
RingBufWrite(&outbuf,buf,len); RingBufWrite(&outbuf,buf,len);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment