diff --git a/libs/iksemel/src/stream.c b/libs/iksemel/src/stream.c index 25593a8d47..2ce7460c20 100644 --- a/libs/iksemel/src/stream.c +++ b/libs/iksemel/src/stream.c @@ -516,9 +516,10 @@ iks_recv (iksparser *prs, int timeout) #endif { len = data->trans->recv (data->sock, data->buf, NET_IO_BUF_SIZE - 1, timeout); + if (len == 0) len = -1; } - if (len <= 0) return IKS_NET_RWERR; - + if (len < 0) return IKS_NET_RWERR; + if (len == 0) break; data->buf[len] = '\0'; if (data->logHook) data->logHook (data->user_data, data->buf, len, 1); ret = iks_parse (prs, data->buf, len, 0);