From a45e91e2cfa161c769cc5341186af4a8fe9bfe73 Mon Sep 17 00:00:00 2001 From: "Jean-Marc Pigeon (Delson)" Date: Fri, 9 Aug 2024 20:29:16 -0400 Subject: [PATCH] save before cleaning JMPDBG code --- lib/subrou.c | 2 +- lib/unitls.c | 84 ++++++++++++++++++++++------------------------------ 2 files changed, 37 insertions(+), 49 deletions(-) diff --git a/lib/subrou.c b/lib/subrou.c index 0ff04c6..fece781 100644 --- a/lib/subrou.c +++ b/lib/subrou.c @@ -20,7 +20,7 @@ //version definition #define VERSION "0.3" -#define RELEASE "40" +#define RELEASE "41" //Public variables PUBLIC int debug=0; //debug level diff --git a/lib/unitls.c b/lib/unitls.c index 18415d9..bf9d9b6 100644 --- a/lib/unitls.c +++ b/lib/unitls.c @@ -487,17 +487,16 @@ sent=0; if (tls!=(TLSTYP *)0) { _Bool proceed; int sofar; - int count; - count=0; proceed=true; (void) printf("JMPDBG sending <%s>\n",buffer); while (proceed==true) { int status; + status=0; proceed=false; sofar=SSL_write(tls->ssl,buffer,tosend); - (void) printf("JMPDBG sent sofar='%d' count='%d'\n",sofar,count); + (void) printf("JMPDBG sent sofar='%d'\n",sofar); switch (sofar) { case -1 : //trouble to write switch (status=SSL_get_error(tls->ssl,-1)) { @@ -505,7 +504,6 @@ if (tls!=(TLSTYP *)0) { case SSL_ERROR_WANT_WRITE : //"Wanted" error (void) printf("JMPDBG SSL_get_error='%d'\n",status); (void) usleep(1000); - count++; proceed=true; break; default : @@ -528,7 +526,6 @@ if (tls!=(TLSTYP *)0) { (void) showtlserror(tls,0,"show SSL error",OPEP); break; } - (void) sleep(1); break; default : //some character sent sent+=sofar; @@ -561,49 +558,40 @@ int got; got=-1; if (tls!=(TLSTYP *)0) { - _Bool proceed; - int count; - - count=0; - proceed=true; - - (void) printf("JMPDBG receiving\n"); - while (proceed==true) { - int status; - - proceed=false; - got=SSL_read(tls->ssl,buffer,maxread); - (void) printf("JMPDBG read got='%d' count='%d'\n",got,count); - switch (got) { - case -1 : //trouble to write - switch (status=SSL_get_error(tls->ssl,-1)) { - case SSL_ERROR_WANT_READ : //"wanted" error - case SSL_ERROR_WANT_WRITE : // - (void) printf("JMPDBG SSL_get_error='%d'\n",status); - (void) usleep(1000); - break; - default : - (void) showtlserror(tls,-1,"%s Premature EOF with crypted link",OPEP); - break; - } - break; - case 0 : //no char sent - switch (SSL_get_error(tls->ssl,0)) { - case SSL_ERROR_SYSCALL : //EOF received? - tls->goteof=true; - if (ERR_get_error()!=0) - (void) rou_alert(0,"%s wrong EOF",OPEP); - break; - default : - (void) rou_alert(0,"%s Unexpected SSL_read error='%d'", - OPEP,SSL_get_error(tls->ssl,0)); - (void) showtlserror(tls,0,"show SSL error",OPEP); - break; - } - break; - default : //some character received - break; - } + int status; + + status=0; + got=SSL_read(tls->ssl,buffer,maxread); + (void) printf("JMPDBG read got='%d'\n",got); + switch (got) { + case -1 : //trouble to write + switch (status=SSL_get_error(tls->ssl,-1)) { + case SSL_ERROR_WANT_READ : //"wanted" error + case SSL_ERROR_WANT_WRITE : // + (void) printf("JMPDBG SSL_get_error='%d'\n",status); + (void) usleep(1000); + break; + default : + (void) showtlserror(tls,-1,"%s Premature EOF with crypted link",OPEP); + break; + } + break; + case 0 : //no char sent + switch (SSL_get_error(tls->ssl,0)) { + case SSL_ERROR_SYSCALL : //EOF received? + tls->goteof=true; + if (ERR_get_error()!=0) + (void) rou_alert(0,"%s wrong EOF",OPEP); + break; + default : + (void) rou_alert(0,"%s Unexpected SSL_read error='%d'", + OPEP,SSL_get_error(tls->ssl,0)); + (void) showtlserror(tls,0,"show SSL error",OPEP); + break; + } + break; + default : //some character received + break; } } return got; -- 2.47.3