]> code.citadel.org Git - citadel.git/blobdiff - citadel/context.h
* if we're shutting down instantly close our server file descriptions
[citadel.git] / citadel / context.h
index 1e57f2f39fc9ec7798ae660fbde2348c7f35b0b2..b4607da63dc8ca37ab65b512b867722ce83c19b6 100644 (file)
@@ -1,4 +1,3 @@
-/* $Id: sysdep_decls.h 7265 2009-03-25 23:18:46Z dothebart $ */
 
 #ifndef CONTEXT_H
 #define CONTEXT_H
@@ -38,9 +37,7 @@ struct CitContext {
        int client_socket;
        int is_local_socket;    /* set to 1 if client is on unix domain sock */
        /* Redirect this session's output to a memory buffer? */
-       char *redirect_buffer;          /* the buffer */
-       size_t redirect_len;            /* length of data in buffer */
-       size_t redirect_alloc;          /* length of allocated buffer */
+       StrBuf *redirect_buffer;                /* the buffer */
 #ifdef HAVE_OPENSSL
        SSL *ssl;
        int redirect_ssl;
@@ -156,9 +153,12 @@ void RemoveContext (struct CitContext *);
 CitContext *CreateNewContext (void);
 void context_cleanup(void);
 void kill_session (int session_to_kill);
-INLINE void become_session(struct CitContext *which_con);
 void InitializeMasterCC(void);
 void dead_session_purge(int force);
+void set_async_waiting(struct CitContext *ccptr);
+
+/* forcibly close and flush fd's on shutdown */
+void terminate_stuck_sessions(void);
 
 /* Deprecated, user CtdlBumpNewMailCounter() instead */
 void BumpNewMailCounter(long) __attribute__ ((deprecated));
@@ -170,4 +170,22 @@ int CtdlTerminateOtherSession (int session_num);
 #define TERM_ALLOWED   0x02
 #define TERM_KILLED    0x03
 #define TERM_NOTALLOWED -1
+
+/*
+ * Bind a thread to a context.  (It's inline merely to speed things up.)
+ */
+static INLINE void become_session(CitContext *which_con) {
+/*
+       pid_t tid = syscall(SYS_gettid);
+*/
+       citthread_setspecific(MyConKey, (void *)which_con );
+/*
+       CtdlLogPrintf(CTDL_DEBUG, "[%d]: Now doing %s\n", 
+                     (int) tid, 
+                     ((which_con != NULL) && (which_con->ServiceName != NULL)) ? 
+                     which_con->ServiceName:"");
+*/
+}
+
+
 #endif /* CONTEXT_H */