X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2Frmr%2Fsi%2Fsrc%2Fsi95%2Fsipoll.c;h=6c8915a87a0aedfb0efac6de6d6e3b0713f1693a;hb=refs%2Fchanges%2F15%2F5115%2F2;hp=8c28977cddc36fe7b99ec09fa929da386b5ab8fb;hpb=c113b0836f3ebd58911c30de1636a707174efe55;p=ric-plt%2Flib%2Frmr.git diff --git a/src/rmr/si/src/si95/sipoll.c b/src/rmr/si/src/si95/sipoll.c index 8c28977..6c8915a 100644 --- a/src/rmr/si/src/si95/sipoll.c +++ b/src/rmr/si/src/si95/sipoll.c @@ -42,14 +42,11 @@ extern int SIpoll( struct ginfo_blk *gptr, int msdelay ) { - //extern int deaths; // number of children that died and are zombies - //extern int sigflags; // flags set by the signal handler routine - int fd; // file descriptor for use in this routine int ((*cbptr)()); // pointer to callback routine to call int status = SI_OK; // return status - int addrlen; // length of address from recvfrom call - char *buf; // work buffer pointer + int addrlen = 0; // length of address from recvfrom call + char *buf; // work buffer pointer char ibuf[1025]; int i; // loop index struct tp_blk *tpptr; // pointer at tp stuff @@ -77,36 +74,12 @@ extern int SIpoll( struct ginfo_blk *gptr, int msdelay ) pstat = select( gptr->fdcount, &gptr->readfds, &gptr->writefds, &gptr->execpfds, &delay ); - if( (pstat < 0 && errno != EINTR) ) + if( pstat < 0 && errno != EINTR ) { // poll fail or termination signal rcvd gptr->fdcount = 0; // prevent trying to look at a session gptr->flags |= GIF_SHUTDOWN; // cause cleanup and exit at end - //deaths = 0; // dont need to issue waits on dead child - //sigflags = 0; // who cares about signals now too } -/* - while( deaths > 0 ) // there have been death(s) - keep the dead - { // from being zombies - send them to heaven - wait( NULL ); // issue wait on child - deaths--; - } // end while dead children to send to heaven -*/ - -/* - if( sigflags && // if signal received and processing them - (cbptr = gptr->cbtab[SI_CB_SIGNAL].cbrtn) != NULL ) - { - while( sigflags != 0 ) - { - i = sigflags; // hold for call - sigflags = 0; // incase we are interrupted while away - status = (*cbptr)( gptr->cbtab[SI_CB_SIGNAL].cbdata, i ); - SIcbstat( gptr, status, SI_CB_SIGNAL ); // handle status - } // end while - } -*/ - if( pstat > 0 && (! (gptr->flags & GIF_SHUTDOWN)) ) { if( FD_ISSET( 0, &gptr->readfds ) ) // check for keybd input @@ -119,7 +92,6 @@ extern int SIpoll( struct ginfo_blk *gptr, int msdelay ) } // end if call back was defined } - // for( tpptr = gptr->tplist; tpptr != NULL; tpptr = tpptr->next ) tpptr = gptr->tplist; while( tpptr != NULL ) { nextone = tpptr->next; // allow for a delete in loop @@ -138,7 +110,7 @@ extern int SIpoll( struct ginfo_blk *gptr, int msdelay ) if( tpptr->flags & TPF_LISTENFD ) // listen port setup by init? { // yes-assume new session req - status = SInewsession( gptr, tpptr ); // make new session + SInewsession( gptr, tpptr ); // cannot do anything about failure, so ignore status } else // data received on a regular port if( tpptr->type == SOCK_DGRAM ) // udp socket? @@ -153,6 +125,7 @@ extern int SIpoll( struct ginfo_blk *gptr, int msdelay ) status = (*cbptr)( gptr->cbtab[SI_CB_RDATA].cbdata, gptr->rbuf, status, buf ); SIcbstat( gptr, status, SI_CB_RDATA ); // handle status free( buf ); + buf = NULL; // just to be safe } // end if call back was defined } // end if status was ok free( uaddr );