laforge has submitted this change and it was merged. ( 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(+), 14 deletions(-) Approvals: pespin: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/osmobts_sock.cpp b/src/osmobts_sock.cpp index a3e9d63..4321696 100644 --- a/src/osmobts_sock.cpp +++ b/src/osmobts_sock.cpp @@ -143,22 +143,14 @@ int rc; rc = recv(bfd->fd, &pcu_prim, sizeof(pcu_prim), 0); - if (rc == 0) - goto close; - - if (rc < 0) { - if (errno == EAGAIN) - return 0; - goto close; + if (rc < 0 && errno == EAGAIN) + return 0; /* Try again later */ + if (rc <= 0) { + 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: 2 Gerrit-Owner: fixeria <axilira...@gmail.com> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <lafo...@gnumonks.org> Gerrit-Reviewer: pespin <pes...@sysmocom.de> Gerrit-MessageType: merged