Permalink
Browse files

[DAEMONS] telnetd: Don't disconnect upon receive timeout

We can get frequent receive timeout in telnetd_fill_rx_buffer()
if remote telnet client is becoming idle quite often.

Actually, getting receive timeout in socket programming is not
an error condition hence we should not disconnect connection
upon receive timeout.

This patch fixes telnetd_fill_rx_buffer() as-per above and also
minor fixes minor compilation error in daemon_telnetd_init().

Signed-off-by: Anup Patel <anup@brainfault.org>
  • Loading branch information...
1 parent 8894a64 commit 003ba237d669878d5693f9bd5adf3af1f4a3e569 @avpatel avpatel committed Feb 13, 2014
Showing with 6 additions and 4 deletions.
  1. +6 −4 daemons/telnetd.c
View
@@ -238,9 +238,13 @@ static void telnetd_fill_rx_buffer(void)
/* Recieve netstack socket buffer */
rc = netstack_socket_recv(tdctrl.active_sk, &buf, -1);
- if (rc) {
+ if (rc == VMM_ETIMEDOUT) {
+ TELNETD_DPRINTF("%s: Socket read timedout\n", __func__);
+ return;
+ } else if (rc) {
telnetd_set_disconnected();
- TELNETD_DPRINTF("%s: Socket read failed\n", __func__);
+ TELNETD_DPRINTF("%s: Socket read failed (error %d)\n",
+ __func__, rc);
return;
}
@@ -530,10 +534,8 @@ static int __init daemon_telnetd_init(void)
tdctrl.cdev_ingets = FALSE;
tdctrl.cdev_incmdexec = FALSE;
strcpy(tdctrl.cdev.name, "telnetd");
- tdctrl.cdev.dev = NULL;
tdctrl.cdev.read = telnetd_chardev_read;
tdctrl.cdev.write = telnetd_chardev_write;
- tdctrl.cdev.ioctl = NULL;
/* Note: We don't register telnetd dummy character device so that
* it is not visible to other part of hypervisor. This way we can

0 comments on commit 003ba23

Please sign in to comment.