fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-pcu/+/15280
Change subject: osmobts_sock.cpp: pcu_sock_read(): further simplify the code ...................................................................... osmobts_sock.cpp: pcu_sock_read(): further simplify the code Change-Id: Ie7c0ca8baf0ae5beadda60bda0bc76a44664d439 --- M src/osmobts_sock.cpp 1 file changed, 6 insertions(+), 13 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/80/15280/1 diff --git a/src/osmobts_sock.cpp b/src/osmobts_sock.cpp index a3e9d63..95f8710 100644 --- a/src/osmobts_sock.cpp +++ b/src/osmobts_sock.cpp @@ -143,22 +143,15 @@ int rc; rc = recv(bfd->fd, &pcu_prim, sizeof(pcu_prim), 0); - if (rc == 0) - goto close; - - if (rc < 0) { - if (errno == EAGAIN) + if (rc <= 0) { + /* Try again later */ + if (rc < 0 && errno == EAGAIN) return 0; - goto close; + pcu_sock_close(state, 1); + return -EIO; } - rc = pcu_rx(pcu_prim.msg_type, &pcu_prim); - - return rc; - -close: - pcu_sock_close(state, 1); - return -1; + return pcu_rx(pcu_prim.msg_type, &pcu_prim); } static int pcu_sock_write(struct osmo_fd *bfd) -- To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/15280 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Change-Id: Ie7c0ca8baf0ae5beadda60bda0bc76a44664d439 Gerrit-Change-Number: 15280 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <axilira...@gmail.com> Gerrit-MessageType: newchange