aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2018-08-28 17:49:29 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2018-08-28 17:56:59 +0200
commit3750dea96852b453029f91d4b3a66912745290d9 (patch)
treeeaf83c61f53ead32dfe117aa8e12008123873b63
parent493c8e6008f3cd27366b0a007f3b96a05e3df75a (diff)
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
-rw-r--r--src/input/ipa.c10
1 files changed, 4 insertions, 6 deletions
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 @@ static void ipa_server_conn_read(struct ipa_server_conn *conn)
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;
}