summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRobert James Kaes <rjkaes@users.sourceforge.net>2001-05-30 15:45:14 +0000
committerRobert James Kaes <rjkaes@users.sourceforge.net>2001-05-30 15:45:14 +0000
commit5b11a1e2c93e5d0ce20cf56dc3e5e514407d15dd (patch)
tree616deee5afe1827274460a391b838233117c9002 /src
parent101cf497d5dae1c35a760a03ed83777f7b3c4674 (diff)
downloadtinyproxy-5b11a1e2c93e5d0ce20cf56dc3e5e514407d15dd.tar.gz
tinyproxy-5b11a1e2c93e5d0ce20cf56dc3e5e514407d15dd.zip
Formating changes. Also, explictly close the client_fd when the
connections are destroyed.
Diffstat (limited to '')
-rw-r--r--src/reqs.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/reqs.c b/src/reqs.c
index 782d8c2..feb7a9e 100644
--- a/src/reqs.c
+++ b/src/reqs.c
@@ -1,4 +1,4 @@
-/* $Id: reqs.c,v 1.13 2001-05-27 02:29:06 rjkaes Exp $
+/* $Id: reqs.c,v 1.14 2001-05-30 15:45:14 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
@@ -530,24 +530,24 @@ static void relay_connection(struct conn_s *connptr)
*/
last_access = time(NULL);
}
-
+
if (FD_ISSET(connptr->server_fd, &rset)
&& readbuff(connptr->server_fd, connptr->sbuffer) < 0) {
- shutdown(connptr->server_fd, SHUT_WR);
- break;
+ shutdown(connptr->server_fd, SHUT_WR);
+ break;
}
if (FD_ISSET(connptr->client_fd, &rset)
&& readbuff(connptr->client_fd, connptr->cbuffer) < 0) {
- return;
+ return;
}
if (FD_ISSET(connptr->server_fd, &wset)
&& writebuff(connptr->server_fd, connptr->cbuffer) < 0) {
- shutdown(connptr->server_fd, SHUT_WR);
- break;
+ shutdown(connptr->server_fd, SHUT_WR);
+ break;
}
if (FD_ISSET(connptr->client_fd, &wset)
&& writebuff(connptr->client_fd, connptr->sbuffer) < 0) {
- return;
+ return;
}
}
@@ -578,7 +578,8 @@ static void initialize_conn(struct conn_s *connptr)
static void destroy_conn(struct conn_s *connptr)
{
- connptr->client_fd = -1;
+ if (connptr->client_fd != -1)
+ close(connptr->client_fd);
if (connptr->server_fd != -1)
close(connptr->server_fd);