diff options
author | Andreas Baumann <mail@andreasbaumann.cc> | 2014-09-18 16:09:21 +0200 |
---|---|---|
committer | Andreas Baumann <mail@andreasbaumann.cc> | 2014-09-18 16:09:21 +0200 |
commit | f6dd3cfcfecfc4881261b00ca2874ffaa432b08e (patch) | |
tree | 2c8f470b2abab83181849e19de11deaed3ae0186 | |
parent | 360a2f310b17f3610db6d6915eb5cbe7b646cf25 (diff) | |
download | biruda-f6dd3cfcfecfc4881261b00ca2874ffaa432b08e.tar.gz biruda-f6dd3cfcfecfc4881261b00ca2874ffaa432b08e.tar.bz2 |
eliminated a goto in the master code
-rw-r--r-- | src/master.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/master.c b/src/master.c index 4572a65..5e78aa2 100644 --- a/src/master.c +++ b/src/master.c @@ -41,13 +41,12 @@ NEXT_DISCOVER: int bytes = nn_send( master_sock, msg, msg_size, 0 ); if( bytes < 0 ) { if( errno == ETERM ) { - goto MASTER_ENDS; + master_must_terminate = 1; } else { fprintf( stderr, "ERROR: nn_send returned %d: %s (%d)\n", bytes, nn_strerror( errno ), errno ); } - } - if( bytes != msg_size ) { + } else if( bytes != msg_size ) { fprintf( stderr, "ERROR: truncated message!" ); } json_object_put( obj ); @@ -82,8 +81,6 @@ NEXT_DISCOVER: } } -MASTER_ENDS: - (void)nn_shutdown( master_sock, 0 ); puts( "master disconnected" ); |