diff options
author | Andreas Baumann <mail@andreasbaumann.cc> | 2014-09-17 13:16:42 +0200 |
---|---|---|
committer | Andreas Baumann <mail@andreasbaumann.cc> | 2014-09-17 13:16:42 +0200 |
commit | 237e7efb2964796a9ee4ca61905b7481f08efc08 (patch) | |
tree | bc250c1d1e0e0207a73a5a0977d0ad0055072978 /src/master.c | |
parent | f60fb626f809aaf91d9be77eca3f000d1081c0bb (diff) | |
download | biruda-237e7efb2964796a9ee4ca61905b7481f08efc08.tar.gz biruda-237e7efb2964796a9ee4ca61905b7481f08efc08.tar.bz2 |
more error handling around nn_send
Diffstat (limited to 'src/master.c')
-rw-r--r-- | src/master.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/master.c b/src/master.c index d2c3728..a73a7b1 100644 --- a/src/master.c +++ b/src/master.c @@ -39,6 +39,14 @@ NEXT_DISCOVER: int msg_size = strlen( msg ) + 1; printf( "master send: %s\n", msg ); int bytes = nn_send( master_sock, msg, msg_size, 0 ); + if( bytes < 0 ) { + if( errno == ETERM ) { + goto END; + } else { + fprintf( stderr, "ERROR: nn_send returned %d: %s (%d)\n", + bytes, nn_strerror( errno ), errno ); + } + } if( bytes != msg_size ) { fprintf( stderr, "ERROR: truncated message!" ); } @@ -70,6 +78,7 @@ NEXT_DISCOVER: } } } +END: (void)nn_shutdown( master_sock, 0 ); |