Change in ...osmo-pcu[master]: osmobts_sock.cpp: pcu_sock_read(): further simplify the code

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

laforge gerrit-no-reply at lists.osmocom.org
Tue Aug 27 11:32:42 UTC 2019


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 <axilirator at gmail.com>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at gnumonks.org>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190827/28462979/attachment.htm>


More information about the gerrit-log mailing list