Skip to content

Commit

Permalink
staging: usbip: vhci: friendly log messages for connection errors
Browse files Browse the repository at this point in the history
Also changes the event on connection close to be
VDEV_EVENT_DOWN - no functional change.

Signed-off-by: Max Vozeler <max@vozeler.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Max Vozeler authored and Greg Kroah-Hartman committed Jan 21, 2011
1 parent 6d21215 commit 7e249c8
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions drivers/staging/usbip/vhci_rx.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,11 +205,23 @@ static void vhci_rx_pdu(struct usbip_device *ud)

memset(&pdu, 0, sizeof(pdu));


/* 1. receive a pdu header */
ret = usbip_xmit(0, ud->tcp_socket, (char *) &pdu, sizeof(pdu), 0);
if (ret < 0) {
if (ret == -ECONNRESET)
usbip_uinfo("connection reset by peer\n");
else if (ret != -ERESTARTSYS)
usbip_uinfo("xmit failed %d\n", ret);
usbip_event_add(ud, VDEV_EVENT_ERROR_TCP);
return;
}
if (ret == 0) {
usbip_uinfo("connection closed");
usbip_event_add(ud, VDEV_EVENT_DOWN);
return;
}
if (ret != sizeof(pdu)) {
usbip_uerr("receiving pdu failed! size is %d, should be %d\n",
usbip_uerr("received pdu size is %d, should be %d\n",
ret, (unsigned int)sizeof(pdu));
usbip_event_add(ud, VDEV_EVENT_ERROR_TCP);
return;
Expand Down

0 comments on commit 7e249c8

Please sign in to comment.