diff options
author | Robert James Kaes <rjkaes@users.sourceforge.net> | 2001-10-25 16:58:50 +0000 |
---|---|---|
committer | Robert James Kaes <rjkaes@users.sourceforge.net> | 2001-10-25 16:58:50 +0000 |
commit | d3b099140fa2d221479c67b2be921abac8481798 (patch) | |
tree | ae396afaf4229aaa06e94bf028e5eafc35b9e599 | |
parent | f8ad0dced37cb3b2b4402d12ac654bc27beaa8e4 (diff) | |
download | tinyproxy-d3b099140fa2d221479c67b2be921abac8481798.tar.gz tinyproxy-d3b099140fa2d221479c67b2be921abac8481798.zip |
Some code clean up due to the creation of the conns.{c,h} files which now
store the creation/destruction and definition of the connection structure.
-rw-r--r-- | src/Makefile.am | 3 | ||||
-rw-r--r-- | src/reqs.c | 35 | ||||
-rw-r--r-- | src/stats.h | 4 | ||||
-rw-r--r-- | src/tinyproxy.h | 11 | ||||
-rw-r--r-- | src/utils.c | 3 | ||||
-rw-r--r-- | src/utils.h | 4 |
6 files changed, 13 insertions, 47 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 058a83e..c172351 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,4 +1,4 @@ -# $Id: Makefile.am,v 1.5 2001-10-01 04:01:10 rjkaes Exp $ +# $Id: Makefile.am,v 1.6 2001-10-25 16:58:50 rjkaes Exp $ # # # @@ -21,6 +21,7 @@ LDFLAGS = @LDFLAGS@ bin_PROGRAMS = tinyproxy tinyproxy_SOURCES = \ + conns.c conns.h \ buffer.c buffer.h \ dnscache.c dnscache.h \ log.c log.h \ @@ -1,4 +1,4 @@ -/* $Id: reqs.c,v 1.34 2001-10-25 05:12:46 rjkaes Exp $ +/* $Id: reqs.c,v 1.35 2001-10-25 16:58:50 rjkaes Exp $ * * This is where all the work in tinyproxy is actually done. Incoming * connections have a new thread created for them. The thread then @@ -28,6 +28,7 @@ #include "acl.h" #include "anonymous.h" #include "buffer.h" +#include "conns.h" #include "filter.h" #include "log.h" #include "regexp.h" @@ -688,38 +689,6 @@ static void relay_connection(struct conn_s *connptr) return; } -static void initialize_conn(struct conn_s *connptr) -{ - connptr->client_fd = connptr->server_fd = -1; - connptr->cbuffer = new_buffer(); - connptr->sbuffer = new_buffer(); - - connptr->send_message = FALSE; - connptr->simple_req = FALSE; - - connptr->ssl = FALSE; - connptr->upstream = FALSE; - - update_stats(STAT_OPEN); -} - -static void destroy_conn(struct conn_s *connptr) -{ - if (connptr->client_fd != -1) - close(connptr->client_fd); - if (connptr->server_fd != -1) - close(connptr->server_fd); - - if (connptr->cbuffer) - delete_buffer(connptr->cbuffer); - if (connptr->sbuffer) - delete_buffer(connptr->sbuffer); - - safefree(connptr); - - update_stats(STAT_CLOSE); -} - #ifdef UPSTREAM_SUPPORT /* * Establish a connection to the upstream proxy server. diff --git a/src/stats.h b/src/stats.h index c2d21f8..26f5462 100644 --- a/src/stats.h +++ b/src/stats.h @@ -1,4 +1,4 @@ -/* $Id: stats.h,v 1.2 2001-09-16 20:11:24 rjkaes Exp $ +/* $Id: stats.h,v 1.3 2001-10-25 16:58:50 rjkaes Exp $ * * See 'stats.h' for a detailed description. * @@ -18,6 +18,8 @@ #ifndef _TINYPROXY_STATS_H_ #define _TINYPROXY_STATS_H_ +#include "conns.h" + /* * Various logable statistics */ diff --git a/src/tinyproxy.h b/src/tinyproxy.h index 608973b..03aa197 100644 --- a/src/tinyproxy.h +++ b/src/tinyproxy.h @@ -1,4 +1,4 @@ -/* $Id: tinyproxy.h,v 1.17 2001-10-25 05:10:57 rjkaes Exp $ +/* $Id: tinyproxy.h,v 1.18 2001-10-25 16:58:50 rjkaes Exp $ * * See 'tinyproxy.c' for a detailed description. * @@ -113,15 +113,6 @@ struct config_s { }; -struct conn_s { - int client_fd, server_fd; - struct buffer_s *cbuffer, *sbuffer; - bool_t simple_req; - bool_t ssl; - bool_t upstream; - bool_t send_message; -}; - /* Global Structures used in the program */ extern struct config_s config; diff --git a/src/utils.c b/src/utils.c index 2feed99..3901027 100644 --- a/src/utils.c +++ b/src/utils.c @@ -1,4 +1,4 @@ -/* $Id: utils.c,v 1.14 2001-10-24 00:37:23 rjkaes Exp $ +/* $Id: utils.c,v 1.15 2001-10-25 16:58:50 rjkaes Exp $ * * Misc. routines which are used by the various functions to handle strings * and memory allocation and pretty much anything else we can think of. Also, @@ -26,6 +26,7 @@ #include <sysexits.h> #include "buffer.h" +#include "conns.h" #include "log.h" #include "sock.h" #include "utils.h" diff --git a/src/utils.h b/src/utils.h index d0fa57e..ba6976c 100644 --- a/src/utils.h +++ b/src/utils.h @@ -1,4 +1,4 @@ -/* $Id: utils.h,v 1.9 2001-09-15 21:29:59 rjkaes Exp $ +/* $Id: utils.h,v 1.10 2001-10-25 16:58:50 rjkaes Exp $ * * See 'utils.h' for a detailed description. * @@ -21,6 +21,8 @@ #include "tinyproxy.h" +#include "conns.h" + extern int send_http_message(struct conn_s* connptr, int http_code, const char *error_title, const char *message); extern int httperr(struct conn_s *connptr, int err, const char *msg); |