From 518b0bed99a7654fb9f95696602b93749116dd19 Mon Sep 17 00:00:00 2001 From: "Jean-Marc Pigeon (Delson)" Date: Mon, 31 Mar 2025 15:54:48 -0400 Subject: [PATCH] Disconnect detected and debug code cleanned --- app/feeder.c | 8 +++++--- lib/devsoc.c | 23 +++++++++-------------- lib/modrec.c | 2 -- lib/subrou.c | 2 +- 4 files changed, 15 insertions(+), 20 deletions(-) diff --git a/app/feeder.c b/app/feeder.c index 9c9ac7e..f651f75 100644 --- a/app/feeder.c +++ b/app/feeder.c @@ -103,7 +103,7 @@ tocheck=strlen(line); phase=0; proceed=true; while (proceed==true) { - //(void) rou_alert(0,"JMPDBG %s, phase='%d'",OPEP,phase); + //(void) rou_alert(0,"%s JMPDBG, phase='%d'",OPEP,phase); switch (phase) { case 0 : //do we have a "..." sequence at the end if (tocheck>0) { @@ -119,7 +119,6 @@ while (proceed==true) { case 1 : //waiting for a line with CRLF received=(char *)0; got=tcp_getline(socptr,WAITLINE,&received); - (void) rou_alert(0,"%s, JMPDNG got='%d'",OPEP,got); switch (got) { case 0 : //Reading timeout (void) rou_alert(0,"Unable to receive line in due time"); @@ -156,6 +155,7 @@ while (proceed==true) { phase++; } return status; +#undef OPEP } /* @@ -168,6 +168,7 @@ return status; static _Bool scanline(SOCPTR *socptr,int numline,char *line) { +#define OPEP "feeder.c:scanline" _Bool status; int phase; _Bool proceed; @@ -175,7 +176,7 @@ _Bool proceed; status=true; phase=0; proceed=true; -(void) rou_alert(0,"JMPDBG phase='%d' line=<%s>",phase,line); +(void) rou_alert(5,"%s line=<%s>",OPEP,line); while (proceed==true) { switch (phase) { case 0 : //removing first space @@ -212,6 +213,7 @@ while (proceed==true) { phase++; } return status; +#undef OPEP } /* diff --git a/lib/devsoc.c b/lib/devsoc.c index 812eb1a..f683b79 100644 --- a/lib/devsoc.c +++ b/lib/devsoc.c @@ -601,7 +601,7 @@ ai=(struct addrinfo *)0; phase=0; proceed=true; while (proceed==true) { - (void) rou_alert(0,"JMPDBG %s phase='%d'",OPEP,phase); + //(void) rou_alert(0,"JMPDBG %s phase='%d'",OPEP,phase); switch (phase) { case 0 : //Do we have parameters if ((ip==(const char *)0)||(port==(const char *)0)) { @@ -923,20 +923,17 @@ if (soc!=(SOCTYP *)0) { 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)); + case -1 : //polling error + //(void) rou_alert(0,"%s JMPDBG Poll error=<%s>",OPEP,strerror(errno)); break; - case 0 : - (void) rou_alert(0,"%s Polling timeout millisec='%d'",OPEP,millisec); + case 0 : //polling timeout + //(void) rou_alert(0,"%s JMPDBG Polling timeout",OPEP); break; - case 1 : - (void) rou_alert(0,"%s Polling return millisec='%d' revent='%08x", - OPEP,millisec,polling[0].revents); + case 1 : //polling early return (data or event) + //(void) rou_alert(0,"%s JMPDBG Polling return",OPEP); status=-2; //wlets say it is disconnected - if (isconnected(soc)==true) { + if (isconnected(soc)==true) status=soc_receive(socptr); - (void) rou_alert(0,"%s JMPDBG soc_recieve status='%d'",OPEP,status); - } break; default : break; @@ -1087,7 +1084,7 @@ buffer=(char *)0; phase=0; proceed=true; while (proceed==true) { - (void) rou_alert(0,"JMPDBG %s phase='%d'",OPEP,phase); + //(void) rou_alert(0,"JMPDBG %s phase='%d'",OPEP,phase); switch (phase) { case 0 : //is socket available if (soc==(SOCTYP *)0) { @@ -1115,8 +1112,6 @@ while (proceed==true) { got=recv(soc->handle,buffer,limit,MSG_DONTWAIT); break; } - (void) rou_alert(0,"%s, JMPDBG got=%d char buffer=<%s> errno='%d'", - OPEP,got,buffer,errno); break; case 3 : //check about recieved data switch (got) { diff --git a/lib/modrec.c b/lib/modrec.c index 0c9933c..c3cf5c2 100644 --- a/lib/modrec.c +++ b/lib/modrec.c @@ -62,7 +62,6 @@ for (int i=0;i",i,argv[i]); for (int j=0;j<3;j++) { char *sofar; @@ -379,6 +378,5 @@ while (proceed==true) { } phase++; } -(void) rou_alert(0,"JMPDBG %s exiting",OPEP); #undef OPEP } diff --git a/lib/subrou.c b/lib/subrou.c index 4f57ae9..d7bcb9c 100644 --- a/lib/subrou.c +++ b/lib/subrou.c @@ -21,7 +21,7 @@ //version definition #define VERSION "0.6" -#define RELEASE "36" +#define RELEASE "37" #define BRANCH "dvl" //Public variables -- 2.47.3