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
This commit is contained in:
Pau Espin 2018-08-28 16:46:39 +02:00
parent fe6731181c
commit 493c8e6008
1 changed files with 4 additions and 8 deletions

View File

@ -56,17 +56,13 @@ static void ipa_client_read(struct ipa_client_conn *link)
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);