Improve socket error handling so that a socket error isn't an
[u/mdw/putty] / telnet.c
index 6797912..f30902d 100644 (file)
--- a/telnet.c
+++ b/telnet.c
@@ -461,6 +461,11 @@ static void do_telnet_read (char *buf, int len) {
 }
 
 static int telnet_receive(Socket s, int urgent, char *data, int len) {
+    if (urgent==3) {
+        /* A socket error has occurred. */
+        connection_fatal(data);
+        len = 0;
+    }
     if (!len) {
        /* Connection has closed. */
        sk_close(s);