X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=test%2Ftest_si95_em.c;h=44c4e0f6da74e7efab0abc82d94cef71b382f05f;hb=refs%2Ftags%2F4.7.4;hp=9eb7d94f1e64266d91d44f23fa627bc87770cc16;hpb=e15b1382dc618f6832957e67dc638b5e8f3f414d;p=ric-plt%2Flib%2Frmr.git diff --git a/test/test_si95_em.c b/test/test_si95_em.c index 9eb7d94..44c4e0f 100644 --- a/test/test_si95_em.c +++ b/test/test_si95_em.c @@ -144,16 +144,25 @@ static int em_siclose( struct ginfo_blk *gptr, int fd ) { /* If em_send_failures is true, this will fail a small part of the time to simualte connection failures. + + If the port number is < 1000 it will fail -- allowing for specific,single + failure cases. */ static int em_next_fd = 0; static int em_siconnect( struct ginfo_blk *gptr, char *abuf ) { static int count = 0; + char* tok; if( em_send_failures && (count++ % 15 == 14) ) { //fprintf( stderr, " siem is failing connect attempt\n\n" ); return -1; } + if( (tok = strchr( abuf, ':' )) != NULL && atoi( tok+1 ) < 1000 ) { + fprintf( stderr, " siem is emulating connect to (%s) with a failure; port <1000\n", abuf ); + return -1; + } + fprintf( stderr, " siem is emulating connect to (%s) attempt return fd=%d\n", abuf, em_next_fd ); if( em_next_fd < 50 ) { em_next_fd++; @@ -173,7 +182,7 @@ static int em_sigetaddr( struct ginfo_blk *gptr, char *buf ) { return 0; } -static struct tp_blk *em_silisten_prep( struct ginfo_blk *gptr, int type, char* abuf, int family ) { +static struct tp_blk *em_silisten_prep( int type, char* abuf, int family ) { return NULL; }