protocol: Loop on FSM errors
This commit is contained in:
parent
7c8c38d983
commit
33d4d3c9f1
1 changed files with 11 additions and 5 deletions
|
@ -91,12 +91,18 @@ void cr_send_to_runner(const criterion_protocol_msg *message) {
|
|||
}
|
||||
|
||||
unsigned char *buf = NULL;
|
||||
int read = nn_recv(g_client_socket, &buf, NN_MSG, 0);
|
||||
int read = 0;
|
||||
|
||||
if (read <= 0) {
|
||||
criterion_perror("Could not read ack: %s.\n", nn_strerror(errno));
|
||||
abort();
|
||||
}
|
||||
do {
|
||||
read = nn_recv(g_client_socket, &buf, NN_MSG, 0);
|
||||
|
||||
if (read <= 0) {
|
||||
if (read == -1 && errno == EFSM)
|
||||
continue;
|
||||
criterion_perror("Could not read ack: %s.\n", nn_strerror(errno));
|
||||
abort();
|
||||
}
|
||||
} while (read > 0);
|
||||
|
||||
criterion_protocol_ack ack;
|
||||
pb_istream_t stream = pb_istream_from_buffer(buf, read);
|
||||
|
|
Loading…
Add table
Reference in a new issue