diff options
author | Sander Vrijders <[email protected]> | 2017-04-05 11:55:57 +0200 |
---|---|---|
committer | Sander Vrijders <[email protected]> | 2017-04-05 11:55:57 +0200 |
commit | fa1590539e66c17902bb4f09221e6447b3233bfb (patch) | |
tree | ce016f05cf4bad8efc5cf464a5420b1e0ec5a3e8 /src | |
parent | 10195b445b6788c60dfd851e3095fdfcb903e574 (diff) | |
download | ouroboros-fa1590539e66c17902bb4f09221e6447b3233bfb.tar.gz ouroboros-fa1590539e66c17902bb4f09221e6447b3233bfb.zip |
ipcpd: shim-eth-llc: Fix state check in reader
The state check should be done first to avoid blocking on the recv
call.
Diffstat (limited to 'src')
-rw-r--r-- | src/ipcpd/shim-eth-llc/main.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/ipcpd/shim-eth-llc/main.c b/src/ipcpd/shim-eth-llc/main.c index 5a80aa91..d42e6fff 100644 --- a/src/ipcpd/shim-eth-llc/main.c +++ b/src/ipcpd/shim-eth-llc/main.c @@ -536,14 +536,14 @@ static void * eth_llc_ipcp_sdu_reader(void * o) memset(br_addr, 0xff, MAC_SIZE * sizeof(uint8_t)); while (true) { + if (ipcp_get_state() != IPCP_OPERATIONAL) + return (void *) 0; + frame_len = recv(eth_llc_data.s_fd, buf, SHIM_ETH_LLC_MAX_SDU_SIZE, 0); if (frame_len < 0) continue; - if (ipcp_get_state() != IPCP_OPERATIONAL) - return (void *) 0; - llc_frame = (struct eth_llc_frame *) buf; #ifdef __FreeBSD__ |