]> Git Repo - qemu.git/commitdiff
nbd: Shutdown socket before closing.
authorHani Benhabiles <[email protected]>
Sat, 31 May 2014 21:39:42 +0000 (22:39 +0100)
committerPaolo Bonzini <[email protected]>
Mon, 30 Jun 2014 10:50:12 +0000 (12:50 +0200)
This forces finishing data sending to client before closing the socket like in
exports listing or replying with NBD_REP_ERR_UNSUP cases.

Signed-off-by: Hani Benhabiles <[email protected]>
Cc: [email protected]
Signed-off-by: Paolo Bonzini <[email protected]>
blockdev-nbd.c
qemu-nbd.c

index 18dc528761adf89663e338b604caedba716bb6c4..b3a24740b2dbc8f66b84955a125f05ac102ff860 100644 (file)
@@ -28,6 +28,7 @@ static void nbd_accept(void *opaque)
 
     int fd = accept(server_fd, (struct sockaddr *)&addr, &addr_len);
     if (fd >= 0 && !nbd_client_new(NULL, fd, nbd_client_put)) {
+        shutdown(fd, 2);
         close(fd);
     }
 }
index ba6043680a31e5408a73bfb435c570d7e0cac0bf..626e5844f9bd167dda5a8f46722c1c4c8b0572de 100644 (file)
@@ -372,6 +372,7 @@ static void nbd_accept(void *opaque)
     if (nbd_client_new(exp, fd, nbd_client_closed)) {
         nb_fds++;
     } else {
+        shutdown(fd, 2);
         close(fd);
     }
 }
This page took 0.028401 seconds and 4 git commands to generate.