Skip to content

Commit

Permalink
SQUASHME VSOCK: notify other side of SOCK_STREAM disconnect
Browse files Browse the repository at this point in the history
When a SOCK_STREAM socket is released, notify the other side that no
more data will be sent.  This allows the other side to return from
recvmsg(2) or poll(2) and close the connection.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
  • Loading branch information
stefanhaRH committed Oct 22, 2015
1 parent 822d1c3 commit ae3c6c9
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions net/vmw_vsock/virtio_transport_common.c
Expand Up @@ -831,7 +831,14 @@ EXPORT_SYMBOL_GPL(virtio_transport_shutdown);

void virtio_transport_release(struct vsock_sock *vsk)
{
struct sock *sk = &vsk->sk;

pr_debug("%s: vsk=%p\n", __func__, vsk);

/* Tell other side to terminate connection */
if (sk->sk_type == SOCK_STREAM && sk->sk_state == SS_CONNECTED) {
virtio_transport_shutdown(vsk, SHUTDOWN_MASK);
}
}
EXPORT_SYMBOL_GPL(virtio_transport_release);

Expand Down

0 comments on commit ae3c6c9

Please sign in to comment.