]> git.proxmox.com Git - mirror_kronosnet.git/commitdiff
[send/recv] be consistent between readv and recvmmsg handling 0 bytes packets
authorFabio M. Di Nitto <fdinitto@redhat.com>
Fri, 18 Dec 2015 09:00:26 +0000 (10:00 +0100)
committerFabio M. Di Nitto <fdinitto@redhat.com>
Fri, 18 Dec 2015 09:00:26 +0000 (10:00 +0100)
Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
libknet/threads_send_recv.c

index 9c438d73754300ca6a970fff1c1fef02bd47fe09..32db8aa7f812919ae4956baa965a082cee60456a 100644 (file)
@@ -373,7 +373,14 @@ static void _handle_send_to_links(knet_handle_t knet_h, int sockfd, int8_t chann
                        goto out_unlock;
                }
                for (i = 0; i < msg_recv; i++) {
-                        knet_h->recv_from_sock_buf[i]->kh_type = type;
+                       if (msg[i].msg_len == 0) {
+                               err = 0;
+                               savederrno = ENOTCONN;
+                               docallback = 1;
+                               log_err(knet_h, KNET_SUB_SEND_T, "Received 0 bytes message on from socket!");
+                               goto out_unlock;
+                       }
+                       knet_h->recv_from_sock_buf[i]->kh_type = type;
                        _parse_recv_from_sock(knet_h, i, msg[i].msg_len, channel);
                }
        }