]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
let return 0 be a failure on read in iks to avoid cpu race
authorAnthony Minessale <anthony.minessale@gmail.com>
Wed, 22 Apr 2009 21:43:53 +0000 (21:43 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Wed, 22 Apr 2009 21:43:53 +0000 (21:43 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@13123 d0543943-73ff-0310-b7d9-9358b9ac24b2

libs/iksemel/src/stream.c

index b879a1f0912b8e4d8726eab6f4466390114ca062..25593a8d478ae26024a9b5c0a31bbca3d32acb28 100644 (file)
@@ -517,8 +517,8 @@ iks_recv (iksparser *prs, int timeout)
                {
                        len = data->trans->recv (data->sock, data->buf, NET_IO_BUF_SIZE - 1, timeout);
                }
-               if (len < 0) return IKS_NET_RWERR;
-               if (len == 0) break;
+               if (len <= 0) return IKS_NET_RWERR;
+
                data->buf[len] = '\0';
                if (data->logHook) data->logHook (data->user_data, data->buf, len, 1);
                ret = iks_parse (prs, data->buf, len, 0);