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/coordinator.c | |
parent | f60fb626f809aaf91d9be77eca3f000d1081c0bb (diff) | |
download | biruda-237e7efb2964796a9ee4ca61905b7481f08efc08.tar.gz biruda-237e7efb2964796a9ee4ca61905b7481f08efc08.tar.bz2 |
more error handling around nn_send
Diffstat (limited to 'src/coordinator.c')
-rw-r--r-- | src/coordinator.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/coordinator.c b/src/coordinator.c index 4403999..77ff484 100644 --- a/src/coordinator.c +++ b/src/coordinator.c @@ -65,6 +65,14 @@ static void *coordinator_func( void *thread_data ) int msg_size = strlen( msg ) + 1; printf( "coordinator send: %s\n", msg ); bytes = nn_send( coordinator_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!" ); } @@ -79,7 +87,8 @@ static void *coordinator_func( void *thread_data ) } } } - + + END: (void)nn_shutdown( coordinator_sock, 0 ); puts( "coordinator disconnected" ); |