X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2Frmr%2Fsi%2Fsrc%2Fsi95%2Fsiconnect.c;h=5649fabcb2fc7e00da1184485dcacc5e4451eb07;hb=c8c5946b142c5cc04449edc49a599f282c6573e4;hp=77dce63ed27f7f9cdd90eae0cf746058d97d71a7;hpb=43b7981cee870dcf523b910a3af92ccc53556b2a;p=ric-plt%2Flib%2Frmr.git diff --git a/src/rmr/si/src/si95/siconnect.c b/src/rmr/si/src/si95/siconnect.c index 77dce63..5649fab 100644 --- a/src/rmr/si/src/si95/siconnect.c +++ b/src/rmr/si/src/si95/siconnect.c @@ -33,6 +33,8 @@ * 17 Apr 2020 - Add safe connect capabilities ****************************************************************************** */ +#include + #include "sisetup.h" #include "sitransport.h" @@ -114,7 +116,9 @@ extern int SIconnect( struct ginfo_blk *gptr, char *abuf ) { struct sockaddr *taddr; // convenience pointer to addr of target int alen = 0; // len of address struct int fd = SI_ERROR; // file descriptor to return to caller - + int optvalrlen; + int optvalr; + int optvalw; if( PARANOID_CHECKS ) { if( gptr == NULL ) { return SI_ERROR; @@ -129,20 +133,30 @@ extern int SIconnect( struct ginfo_blk *gptr, char *abuf ) { if( tpptr != NULL ) { taddr = tpptr->paddr; errno = 0; + + if( gptr->tcp_flags & SI_TF_QUICK ) { + optvalrlen = sizeof(optvalr); + GETSOCKOPT( tpptr->fd, IPPROTO_TCP, TCP_SYNCNT, (void *)&optvalr, &optvalrlen) ; + optvalw=2; + SETSOCKOPT( tpptr->fd, IPPROTO_TCP, TCP_SYNCNT, (void *)&optvalw, sizeof( optvalw) ) ; + } + if( tpptr->flags & TPF_SAFEC ) { if( safe_connect( tpptr->fd, taddr, tpptr->palen ) != 0 ) { // fd closed on failure - SItrash( TP_BLK, tpptr ); tpptr->fd = -1; } } else { if( CONNECT( tpptr->fd, taddr, tpptr->palen ) != 0 ) { CLOSE( tpptr->fd ); // clean up fd and tp_block tpptr->fd = -1; - SItrash( TP_BLK, tpptr ); // free the trasnsport block } } if( tpptr->fd >= 0 ) { // connect ok + if( gptr->tcp_flags & SI_TF_QUICK ) { + SETSOCKOPT( tpptr->fd, IPPROTO_TCP, TCP_SYNCNT, (void *)&optvalr, sizeof( optvalr) ) ; + } + tpptr->flags |= TPF_SESSION; // indicate we have a session here tpptr->next = gptr->tplist; // add block to the list if( tpptr->next != NULL ) { @@ -152,6 +166,8 @@ extern int SIconnect( struct ginfo_blk *gptr, char *abuf ) { gptr->tplist = tpptr; // point at new head fd = tpptr->fd; // save for return value SImap_fd( gptr, fd, tpptr ); + } else { + SItrash( TP_BLK, tpptr ); // free the trasnsport block } }