Change in libosmo-abis[master]: ipa: Simplify code in ipa_client_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/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Wed Aug 29 07:42:50 UTC 2018


Harald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/10656 )

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

ipa: Simplify code in ipa_client_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: Ic044894980ae2b882d99eb30d9df50066671d8f3
---
M src/input/ipa.c
1 file changed, 4 insertions(+), 8 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Vadim Yanitskiy: Looks good to me, but someone else must approve
  Harald Welte: Looks good to me, approved



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

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

Gerrit-Project: libosmo-abis
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ic044894980ae2b882d99eb30d9df50066671d8f3
Gerrit-Change-Number: 10656
Gerrit-PatchSet: 1
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Vadim Yanitskiy <axilirator at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180829/e93219f2/attachment.htm>


More information about the gerrit-log mailing list