]> SAFE projects GIT repository - jmp/mailleur/commitdiff
save before cleaning JMPDBG code
authorJean-Marc Pigeon (Delson) <jmp@safe.ca>
Sat, 10 Aug 2024 00:29:16 +0000 (20:29 -0400)
committerJean-Marc Pigeon (Delson) <jmp@safe.ca>
Sat, 10 Aug 2024 00:29:16 +0000 (20:29 -0400)
lib/subrou.c
lib/unitls.c

index 0ff04c6b70ac30c7bdda6f70a73c967c7bb69be4..fece781bc5cedefe1213dd868a505e3d5853796e 100644 (file)
@@ -20,7 +20,7 @@
 
 //version definition 
 #define VERSION "0.3"
-#define RELEASE "40"
+#define RELEASE "41"
 
 //Public variables
 PUBLIC  int debug=0;            //debug level
index 18415d9783311efda1f9f4ec718ff93053fff546..bf9d9b696cdbc74f9d8309eddbf7dbae4f2ffd1b 100644 (file)
@@ -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;