If we disconnect the server, clean up thoroughly, so we don't struggle over half...
authorWilfried Goesgens <dothebart@citadel.org>
Thu, 26 Jan 2012 22:09:51 +0000 (23:09 +0100)
committerWilfried Goesgens <dothebart@citadel.org>
Sun, 19 Feb 2012 10:58:10 +0000 (11:58 +0100)
webcit/serv_func.c
webcit/tcp_sockets.c
webcit/webcit.c

index 71d5d57daa6eafd1ab2fdf2c7560381e40aea209..873a3ffde67114687c9492af222b5273a31a1e0a 100644 (file)
@@ -172,6 +172,7 @@ int GetConnected (void)
                WCC->serv_sock = tcp_connectsock(ctdlhost, ctdlport);
        
        if (WCC->serv_sock < 0) {
+               WCC->connected = 0;
                FreeStrBuf(&WCC->ReadBuf);
                return 1;
        }
index 7db07943d4dd9210ba5b2fac3163f205e247d4f5..de63f0ca5cf73baf4c62d8ca4af9dd92be9e9197 100644 (file)
@@ -912,10 +912,12 @@ SessionDestroyModule_TCPSOCKETS
 {
        FreeStrBuf(&sess->CLineBuf);
        FreeStrBuf(&sess->ReadBuf);
+       sess->connected = 0;
        sess->ReadPos = NULL;
        FreeStrBuf(&sess->MigrateReadLineBuf);
        if (sess->serv_sock > 0) {
                syslog(LOG_DEBUG, "Closing socket %d", sess->serv_sock);
                close(sess->serv_sock);
        }
+       sess->serv_sock = -1;
 }
index 94ff1e22e9177b35062ecbf596a779cebaac2c17..944b457c86ab0caf1a5dc2cf536bbc601a0ab605 100644 (file)
@@ -31,7 +31,7 @@ StrBuf *csslocal = NULL;
 HashList *HandlerHash = NULL;
 
 void stuff_to_cookie(int unset_cookie);
-int GetConnected(void);
+extern int GetConnected(void);
 
 
 void PutRequestLocalMem(void *Data, DeleteHashDataFunc DeleteIt)