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
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);