diff options
author | Jordan Augé <jordan.auge+fdio@cisco.com> | 2019-12-13 17:27:13 +0100 |
---|---|---|
committer | Jordan Augé <jordan.auge+fdio@cisco.com> | 2019-12-13 17:29:51 +0100 |
commit | 559ced71487b50028e8c7ce55e87af350cc50029 (patch) | |
tree | 35c1644798e78a50b0762136490d82e758c26a59 /ctrl/libhicnctrl | |
parent | 7795737fc9254bc75d6ff1dcbc9b8372a537b511 (diff) |
[HCIN-455] libhicnctrl incorrectly handles absence of forwarder in synchronous mode after it has connected
Change-Id: I76bc68fb44c0090b4004e8d1da37f906fcaa5b17
Signed-off-by: Jordan Augé <jordan.auge+fdio@cisco.com>
Diffstat (limited to 'ctrl/libhicnctrl')
-rw-r--r-- | ctrl/libhicnctrl/src/api.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/ctrl/libhicnctrl/src/api.c b/ctrl/libhicnctrl/src/api.c index 9fb923d13..23a314c0c 100644 --- a/ctrl/libhicnctrl/src/api.c +++ b/ctrl/libhicnctrl/src/api.c @@ -767,9 +767,8 @@ hc_sock_callback(hc_sock_t * s, hc_data_t ** pdata) for (;;) { int n = hc_sock_recv(s); - if (n == 0) { + if (n == 0) goto ERR_EOF; - } if (n < 0) { switch(errno) { case ECONNRESET: @@ -868,7 +867,7 @@ hc_execute_command(hc_sock_t * s, hc_msg_t * msg, size_t msg_len, } int seq = hc_sock_get_next_seq(s); - + /* Create state used to process the request */ hc_sock_request_t * request = NULL; request = hc_sock_request_create(seq, data, params->parse); @@ -897,8 +896,11 @@ hc_execute_command(hc_sock_t * s, hc_msg_t * msg, size_t msg_len, * several times before success... shall we alternate between blocking * and non-blocking mode ? */ - if (hc_sock_recv(s) < 0) - continue; //break; + int n = hc_sock_recv(s); + if (n == 0) + goto ERR_EOF; + if (n < 0) + break; int rc = hc_sock_process(s, pdata); switch(rc) { case 0: @@ -916,7 +918,10 @@ hc_execute_command(hc_sock_t * s, hc_msg_t * msg, size_t msg_len, } } +ERR_EOF: ret = data->ret; + if (!data->complete) + return -1; if (!pdata) hc_data_free(data); |