- if( (select( tpptr->fd + 1, &readfds, NULL, &execpfds, tptr ) < 0 ) )
- gptr->flags |= GIF_SHUTDOWN; // we must shut on error or signal
- else
- { // poll was successful - see if data ?
- if( FD_ISSET( tpptr->fd, &execpfds ) ) // session error?
- {
- SIterm( gptr, tpptr ); // clean up our end of things
- }
- else
- {
- if( (FD_ISSET( tpptr->fd, &readfds )) )
- { // process data if no signal
- if( tpptr->type == SOCK_DGRAM ) // raw data received
- {
- status = RECVFROM( sid, buf, buflen, 0, uaddr, &addrlen );
- if( abuf )
- {
- SIaddress( uaddr, (void **) &acbuf, AC_TODOT ); // address returns pointer to buf now rather than filling
- strcpy( abuf, acbuf ); // must be back compat with old versions
- free( acbuf );
- }
- if( status < 0 ) // session terminated?
- SIterm( gptr, tpptr ); // so close our end
- }
- else // cooked data received
- {
- status = RECV( sid, buf, buflen, 0 ); // read data into user buf
- if( status < 0 ) // session terminated?
- SIterm( gptr, tpptr ); // so close our end
- }
- } // end event was received
- else // no event was received
- status = 0; // status is just ok
- } // end else - not in shutdown mode after poll
- } // end else pole was successful
- } // end if not already signal shutdown