* Close and clear (set to -1) server socket handle when socket errors are
authorArt Cancro <ajc@citadel.org>
Sun, 29 Feb 2004 22:52:15 +0000 (22:52 +0000)
committerArt Cancro <ajc@citadel.org>
Sun, 29 Feb 2004 22:52:15 +0000 (22:52 +0000)
  detected.  Fixes a chat problem reported by Winzlo.

webcit/ChangeLog
webcit/tcp_sockets.c

index 2fad2635137072374205aae2e2dc4b51009de8f7..138c9163ab62e7252a8ef7d839d1bf586bce04a7 100644 (file)
@@ -1,4 +1,8 @@
 $Log$
+Revision 505.10  2004/02/29 22:52:15  ajc
+* Close and clear (set to -1) server socket handle when socket errors are
+  detected.  Fixes a chat problem reported by Winzlo.
+
 Revision 505.9  2004/02/29 05:34:25  ajc
 * Display the Chat menu option as "Chat with other users in <roomname>"
 
@@ -1696,4 +1700,3 @@ Sun Dec  6 19:50:55 EST 1998 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
 
 1998-12-03 Nathan Bryant <bryant@cs.usm.maine.edu>
        * webserver.c: warning fix
-
index 31a1c0425bd4115e6a26ec75a7b0e23dd7393791..b3c853d31f9d2b0b8c709ce302bb64f9c5853ba8 100644 (file)
@@ -145,6 +145,8 @@ void serv_read(char *buf, int bytes)
                if (rlen < 1) {
                        lprintf(1, "Server connection broken: %s\n",
                                strerror(errno));
+                       close(WC->serv_sock);
+                       WC->serv_sock = (-1);
                        WC->connected = 0;
                        WC->logged_in = 0;
                        return;
@@ -189,6 +191,8 @@ void serv_write(char *buf, int nbytes)
                if (retval < 1) {
                        lprintf(1, "Server connection broken: %s\n",
                                strerror(errno));
+                       close(WC->serv_sock);
+                       WC->serv_sock = (-1);
                        WC->connected = 0;
                        WC->logged_in = 0;
                        return;