]> SAFE projects GIT repository - jmp/mailleur/commitdiff
Set waitforchar in millsec
authorJean-Marc Pigeon (Delson) <jmp@safe.ca>
Sun, 30 Mar 2025 18:04:27 +0000 (14:04 -0400)
committerJean-Marc Pigeon (Delson) <jmp@safe.ca>
Sun, 30 Mar 2025 18:04:27 +0000 (14:04 -0400)
lib/devsoc.c
lib/devsoc.h
lib/gestcp.c
lib/subrou.c

index 0c1eaf8ca0595e77e2e927afdbe2e8b0fb042f3d..2e81c0910b521fe13723910cc72b71ae7b6a1c91 100644 (file)
@@ -856,17 +856,15 @@ while (proceed==true) {
 /*      socket, waiting up to attend second.            */
 /*                                                     */
 /********************************************************/
-PUBLIC int soc_waitforchar(SOCPTR *socptr,u_long microsec)
+PUBLIC int soc_waitforchar(SOCPTR *socptr,u_int millisec)
 
 {
 #define OPEP    "devsoc.c:soc_waitforchar"
 register int status;
-int timeout;
 sigset_t origmask;
 SOCTYP *soc;
 
 status=-1;
-timeout=microsec/1000;  //From microsec to millisec 
 soc=(SOCTYP *)socptr;
 if (soc!=(SOCTYP *)0) {      
   struct pollfd polling[1];
@@ -882,16 +880,17 @@ if (soc!=(SOCTYP *)0) {
       break;
     }
   (void) sigprocmask(SIG_SETMASK,(sigset_t *)0,&origmask);
-  status=poll(polling,1,timeout);
+  status=poll(polling,1,millisec);
   (void) sigprocmask(SIG_SETMASK,&origmask,(sigset_t *)0);
   switch (status) {
     case -1     :
       (void) rou_alert(0,"%s Polling error (error=<%s>)",OPEP,strerror(errno));
       break;
     case  0     :
-      //(void) rou_alert(0,"%s Polling timeout",OPEP);
+      (void) rou_alert(0,"%s Polling timeout millisec='%d'",OPEP,millisec);
       break;
     case 1      :
+      (void) rou_alert(0,"%s Polling return millisec='%d'",OPEP,millisec);
       if ((polling[0].revents&POLLHUP)==POLLHUP) {
         (void) close(soc->handle);
         soc->handle=-1;
index a33cbccef2f2ad51a58dd8ab2f9ac1e582b64a88..01643e37333ab4ce7d0b46d5a5c1400c30221562 100644 (file)
@@ -55,7 +55,7 @@ extern _Bool soc_openbinding(SOCPTR *socptr);
 extern void soc_closebinding(SOCPTR *socptr);
 
 //procedure to wait for character from contact
-extern int soc_waitforchar(SOCPTR *socptr,u_long microsec);
+extern int soc_waitforchar(SOCPTR *socptr,u_int millisec);
 
 //procedure to return a char array with the available line
 extern int soc_getnextline(SOCPTR *socptr,char **lineptr);
index d8081fe1ebe0b272bbb0f51d34b910d291d156cf..20f7a7cb86550cddf8a8692b06cfbeba0e7bae61 100644 (file)
@@ -35,12 +35,10 @@ PUBLIC int tcp_getline(SOCPTR *socptr,u_int secwait,char **lineptr)
 #define OPEP    "gestcp.c:tcp_getline"
 
 int got;
-u_long milliwait;
 int phase;
 _Bool proceed;
 
 got=0;
-milliwait=secwait*100;          //10 msec increment
 phase=0;
 proceed=true;
 while (proceed==true) {
@@ -57,13 +55,9 @@ while (proceed==true) {
         phase=999;      //we got a line.
       break;
     case 2      :       //still need to wait
-      //(void) rou_alert(0,"%s JMPDBG milliwait='%d'",OPEP,milliwait);
-      if (milliwait==0) //waiting time expired?
-        phase=999;
-      milliwait--;
       break;
-    case 3      :       //lets wait 10 ms for input 
-      got=soc_waitforchar(socptr,10000);
+    case 3      :       //lets wait secwait*1000 millisec for input 
+      got=soc_waitforchar(socptr,secwait*1000);
       switch (got) {
         case -1         :       //trouble? signal?
           if ((hangup==true)||(reload==true))
index 6224b1ae96d2cedf9044f94594ee9619441e86a5..3e0e5662394fe1beaaec8771e42d4f5955cd2176 100644 (file)
@@ -21,7 +21,7 @@
 
 //version definition 
 #define VERSION "0.6"
-#define RELEASE "26"
+#define RELEASE "27"
 
 //Public variables
 PUBLIC  int debug=0;            //debug level