CC->kill_me now contains an enum indicating the REASON session was killed
[citadel.git] / citadel / sysdep.c
index 5468d24ca7519af883d5aa7a1209466479b31d95..628e955b3e4577ad57f70803cccd1f93c970c5d1 100644 (file)
@@ -496,7 +496,7 @@ int client_write(const char *buf, int nbytes)
                                {
                                        syslog(LOG_DEBUG, "client_write(%d bytes) select() interrupted.\n", nbytes-bytes_written);
                                        if (CtdlThreadCheckStop()) {
-                                               CC->kill_me = 1;
+                                               CC->kill_me = KILLME_SELECT_INTERRUPTED;
                                                return (-1);
                                        } else {
                                                /* can't trust fd's and stuff so we need to re-create them */
@@ -508,7 +508,7 @@ int client_write(const char *buf, int nbytes)
                                                nbytes - bytes_written,
                                                strerror(errno), errno);
                                        cit_backtrace();
-                                       Ctx->kill_me = 1;
+                                       Ctx->kill_me = KILLME_SELECT_FAILED;
                                        return -1;
                                }
                        }
@@ -523,7 +523,7 @@ int client_write(const char *buf, int nbytes)
                                strerror(errno), errno);
                        cit_backtrace();
                        // syslog(LOG_DEBUG, "Tried to send: %s",  &buf[bytes_written]);
-                       Ctx->kill_me = 1;
+                       Ctx->kill_me = KILLME_WRITE_FAILED;
                        return -1;
                }
                bytes_written = bytes_written + retval;
@@ -744,10 +744,10 @@ int client_read_to(char *buf, int bytes, int timeout)
 
 int HaveMoreLinesWaiting(CitContext *CCC)
 {
-       if ((CCC->kill_me == 1) || (
-           (CCC->RecvBuf.ReadWritePointer == NULL) && 
-           (StrLength(CCC->RecvBuf.Buf) == 0) && 
-           (CCC->client_socket != -1)) )
+       if ((CCC->kill_me != 0) ||
+           ( (CCC->RecvBuf.ReadWritePointer == NULL) && 
+             (StrLength(CCC->RecvBuf.Buf) == 0) && 
+             (CCC->client_socket != -1)) )
                return 0;
        else
                return 1;