Initial keep-alive support for the client socket.
[privoxy.git] / gateway.h
index b887da8..eb439ca 100644 (file)
--- a/gateway.h
+++ b/gateway.h
@@ -1,9 +1,9 @@
 #ifndef GATEWAY_H_INCLUDED
 #define GATEWAY_H_INCLUDED
-#define GATEWAY_H_VERSION "$Id: gateway.h,v 1.7 2002/03/26 22:29:54 swa Exp $"
+#define GATEWAY_H_VERSION "$Id: gateway.h,v 1.12 2008/12/24 17:06:19 fabiankeil Exp $"
 /*********************************************************************
  *
- * File        :  $Source: /cvsroot/ijbswa/current/Attic/gateway.h,v $
+ * File        :  $Source: /cvsroot/ijbswa/current/gateway.h,v $
  *
  * Purpose     :  Contains functions to connect to a server, possibly
  *                using a "gateway" (i.e. HTTP proxy and/or SOCKS4
  *
  * Revisions   :
  *    $Log: gateway.h,v $
+ *    Revision 1.12  2008/12/24 17:06:19  fabiankeil
+ *    Keep a thread around to timeout alive connections
+ *    even if no new requests are coming in.
+ *
+ *    Revision 1.11  2008/11/13 09:08:42  fabiankeil
+ *    Add new config option: keep-alive-timeout.
+ *
+ *    Revision 1.10  2008/10/09 18:21:41  fabiankeil
+ *    Flush work-in-progress changes to keep outgoing connections
+ *    alive where possible. Incomplete and mostly #ifdef'd out.
+ *
+ *    Revision 1.9  2006/07/18 14:48:46  david__schmidt
+ *    Reorganizing the repository: swapping out what was HEAD (the old 3.1 branch)
+ *    with what was really the latest development (the v_3_0_branch branch)
+ *
  *    Revision 1.7  2002/03/26 22:29:54  swa
  *    we have a new homepage!
  *
@@ -99,6 +114,27 @@ struct client_state;
 extern jb_socket forwarded_connect(const struct forward_spec * fwd, 
                                    struct http_request *http, 
                                    struct client_state *csp);
+#ifdef FEATURE_CONNECTION_KEEP_ALIVE
+
+/*
+ * Default number of seconds after which an
+ * open connection will no longer be reused.
+ */
+#define DEFAULT_KEEP_ALIVE_TIMEOUT 180
+
+extern void set_keep_alive_timeout(int timeout);
+extern void initialize_reusable_connections(void);
+extern void forget_connection(jb_socket sfd);
+extern void remember_connection(jb_socket sfd,
+                                const struct http_request *http,
+                                const struct forward_spec *fwd);
+extern int close_unusable_connections(void);
+extern void mark_connection_closed(struct reusable_connection *closed_connection);
+extern int connection_destination_matches(const struct reusable_connection *connection,
+                                          const struct http_request *http,
+                                          const struct forward_spec *fwd);
+#endif /* FEATURE_CONNECTION_KEEP_ALIVE */
+
 
 /*
  * Solaris fix