X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2Frmr%2Fsi%2Fsrc%2Fsi95%2Fsinewses.c;h=56d9b105f0e81fd654ef129c99ab6775c7e4251a;hb=11838bcf76f3614384459cb56e2ce80dea788cef;hp=182fa6a6bc287326455d65fb7098ea41c1017c7f;hpb=bc3de17c3b959fcc6a5ba42f5d3b09402bf89687;p=ric-plt%2Flib%2Frmr.git diff --git a/src/rmr/si/src/si95/sinewses.c b/src/rmr/si/src/si95/sinewses.c index 182fa6a..56d9b10 100644 --- a/src/rmr/si/src/si95/sinewses.c +++ b/src/rmr/si/src/si95/sinewses.c @@ -61,7 +61,7 @@ extern int SInewsession( struct ginfo_blk *gptr, struct tp_blk *tpptr ) { newtp = SInew( TP_BLK ); // get a new tp block for the session if( newtp == NULL ) { - close( status ); // must disconnect the other side + CLOSE( status ); // must disconnect the other side free( addr ); return SI_ERROR; } @@ -71,33 +71,28 @@ extern int SInewsession( struct ginfo_blk *gptr, struct tp_blk *tpptr ) { newtp->next->prev = newtp; // back chain to us } gptr->tplist = newtp; - newtp->paddr = (struct sockaddr *) addr; // partner address + newtp->paddr = (struct sockaddr *) addr; // partner address newtp->fd = status; // save the fd from accept - //fprintf( stderr, ">>>>> newsession: accepted session on fd %d\n", status ); - if( gptr->tcp_flags & SI_TF_NODELAY ) { + if( gptr->tcp_flags & SI_TF_NODELAY ) { // set on/off for no delay configuration optval = 1; } else { optval = 0; } - //fprintf( stderr, ">>>>> newsession: setting no delay = %d\n", optval ); - SETSOCKOPT( tpptr->fd, SOL_TCP, TCP_NODELAY, (void *)&optval, sizeof( optval) ) ; + SETSOCKOPT( tpptr->fd, SOL_TCP, TCP_NODELAY, (void *)&optval, sizeof( optval) ); - - if( gptr->tcp_flags & SI_TF_FASTACK ) { + if( gptr->tcp_flags & SI_TF_FASTACK ) { // set on/off for fast ack config optval = 1; } else { optval = 0; } - //fprintf( stderr, ">>>>> conn_prep: setting quick ack = %d\n", optval ); SETSOCKOPT( tpptr->fd, SOL_TCP, TCP_QUICKACK, (void *)&optval, sizeof( optval) ) ; - SIaddress( addr, (void **) &buf, AC_TODOT ); // get addr of remote side - if( (cbptr = gptr->cbtab[SI_CB_SECURITY].cbrtn) != NULL ) { // invoke the security callback function if there + SIaddress( addr, (void **) &buf, AC_TODOT ); // get addr of remote side; buf must be freed + if( (cbptr = gptr->cbtab[SI_CB_SECURITY].cbrtn) != NULL ) { // invoke the security callback function if there status = (*cbptr)( gptr->cbtab[SI_CB_SECURITY].cbdata, buf ); if( status == SI_RET_ERROR ) { // session to be rejected - SIterm( gptr, newtp ); // terminate new tp block - SItrash( TP_BLK, newtp ); + SIterm( gptr, newtp ); // terminate new tp block (do NOT call trash) free( addr ); free( buf ); return SI_ERROR; @@ -108,7 +103,6 @@ extern int SInewsession( struct ginfo_blk *gptr, struct tp_blk *tpptr ) { newtp->flags |= TPF_SESSION; // indicate a session here - //fprintf( stderr, ">>>> pending connection callback for: %s\n", buf ); if( (cbptr = gptr->cbtab[SI_CB_CONN].cbrtn) != NULL ) { // drive connection callback status=(*cbptr)( gptr->cbtab[SI_CB_CONN].cbdata, newtp->fd, buf ); SIcbstat( gptr, status, SI_CB_CONN ); // handle status @@ -116,6 +110,7 @@ extern int SInewsession( struct ginfo_blk *gptr, struct tp_blk *tpptr ) { SImap_fd( gptr, newtp->fd, newtp ); // add fd to the map + free( buf ); return SI_OK; }