CI: Add silent cmake SonarCloud scan
[ric-plt/lib/rmr.git] / test / test_si95_em.c
index 9eb7d94..44c4e0f 100644 (file)
@@ -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> siem is failing connect attempt\n\n" );
                return -1;
        }
 
+       if( (tok = strchr( abuf, ':' )) != NULL  && atoi( tok+1 ) < 1000 ) {
+               fprintf( stderr, "<SIEM> siem is emulating connect to (%s) with a failure; port <1000\n", abuf );
+               return -1;
+       }
+
        fprintf( stderr, "<SIEM> 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;
 }