Change in libosmo-abis[master]: ipa: Simplify code in ipa_server_conn_read

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

Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Tue Aug 28 16:33:54 UTC 2018


Pau Espin Pedrol has uploaded this change for review. ( https://gerrit.osmocom.org/10657


Change subject: ipa: Simplify code in ipa_server_conn_read
......................................................................

ipa: Simplify code in ipa_server_conn_read

By doing this change we remove a duplicated error code path and thus
avoid having to maintain an extra code path with function pointers.

Change-Id: I5bce9f92209cc2fb37b78792e34f7898c71d2327
---
M src/input/ipa.c
1 file changed, 4 insertions(+), 6 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmo-abis refs/changes/57/10657/1

diff --git a/src/input/ipa.c b/src/input/ipa.c
index 26bf170..554644c 100644
--- a/src/input/ipa.c
+++ b/src/input/ipa.c
@@ -336,15 +336,13 @@
 	LOGIPA(conn, LOGL_DEBUG, "message received\n");
 
 	ret = ipa_msg_recv_buffered(ofd->fd, &msg, &conn->pending_msg);
-	if (ret < 0) {
+	if (ret <= 0) {
 		if (ret == -EAGAIN)
 			return;
-		if (ret == -EPIPE || ret == -ECONNRESET)
+		else if (ret == -EPIPE || ret == -ECONNRESET)
 			LOGIPA(conn, LOGL_ERROR, "lost connection with server\n");
-		ipa_server_conn_destroy(conn);
-		return;
-	} else if (ret == 0) {
-		LOGIPA(conn, LOGL_ERROR, "connection closed with server\n");
+		else if (ret == 0)
+			LOGIPA(conn, LOGL_ERROR, "connection closed with server\n");
 		ipa_server_conn_destroy(conn);
 		return;
 	}

-- 
To view, visit https://gerrit.osmocom.org/10657
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-abis
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I5bce9f92209cc2fb37b78792e34f7898c71d2327
Gerrit-Change-Number: 10657
Gerrit-PatchSet: 1
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180828/e33ea761/attachment.htm>


More information about the gerrit-log mailing list