/* 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];
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;
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);
#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) {
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))