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/.

fixeria gerrit-no-reply at lists.osmocom.org
Fri Aug 23 16:30:31 UTC 2019


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 <axilirator at gmail.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190823/d58055e6/attachment.htm>


More information about the gerrit-log mailing list