[or-cvs] Use socketclose on windows as appropriate; end pid files wi...
Nick Mathewson
nickm at seul.org
Wed Apr 28 21:14:59 UTC 2004
Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/tmp/cvs-serv20395/src/or
Modified Files:
connection.c connection_edge.c cpuworker.c dns.c
Log Message:
Use socketclose on windows as appropriate; end pid files with newline
Index: connection.c
===================================================================
RCS file: /home/or/cvsroot/src/or/connection.c,v
retrieving revision 1.204
retrieving revision 1.205
diff -u -d -r1.204 -r1.205
--- connection.c 28 Apr 2004 20:57:03 -0000 1.204
+++ connection.c 28 Apr 2004 21:14:56 -0000 1.205
@@ -121,7 +121,7 @@
if(conn->s >= 0) {
log_fn(LOG_INFO,"closing fd %d.",conn->s);
- close(conn->s);
+ tor_close_socket(conn->s);
}
memset(conn, 0xAA, sizeof(connection_t)); /* poison memory */
free(conn);
@@ -150,7 +150,7 @@
log_fn(LOG_INFO,"Closing connection (fd %d, type %s, state %d) with data on outbuf.",
conn->s, CONN_TYPE_TO_STRING(conn->type), conn->state);
}
- close(conn->s);
+ tor_close_socket(conn->s);
conn->s = -1;
if(!connection_is_listener(conn)) {
buf_clear(conn->outbuf);
@@ -399,7 +399,7 @@
if(!ERRNO_CONN_EINPROGRESS(errno)) {
/* yuck. kill it. */
log_fn(LOG_INFO,"Connect() to %s:%u failed: %s",address,port,strerror(errno));
- close(s);
+ tor_close_socket(s);
return -1;
} else {
/* it's in progress. set state appropriately and return. */
Index: connection_edge.c
===================================================================
RCS file: /home/or/cvsroot/src/or/connection_edge.c,v
retrieving revision 1.179
retrieving revision 1.180
diff -u -d -r1.179 -r1.180
--- connection_edge.c 28 Apr 2004 19:55:20 -0000 1.179
+++ connection_edge.c 28 Apr 2004 21:14:56 -0000 1.180
@@ -1091,7 +1091,7 @@
if(connection_add(conn) < 0) { /* no space, forget it */
connection_free(conn); /* this closes fd[0] */
- close(fd[1]);
+ tor_close_socket(fd[1]);
return -1;
}
@@ -1101,7 +1101,7 @@
/* attaching to a dirty circuit is fine */
if (connection_ap_handshake_attach_circuit(conn) < 0) {
connection_mark_for_close(conn, 0);
- close(fd[1]);
+ tor_close_socket(fd[1]);
return -1;
}
Index: cpuworker.c
===================================================================
RCS file: /home/or/cvsroot/src/or/cpuworker.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- cpuworker.c 25 Apr 2004 20:37:37 -0000 1.31
+++ cpuworker.c 28 Apr 2004 21:14:56 -0000 1.32
@@ -149,7 +149,7 @@
char tag[TAG_LEN];
crypto_pk_env_t *onion_key = NULL, *last_onion_key = NULL;
- close(fdarray[0]); /* this is the side of the socketpair the parent uses */
+ tor_close_socket(fdarray[0]); /* this is the side of the socketpair the parent uses */
fd = fdarray[1]; /* this side is ours */
#ifndef MS_WINDOWS
connection_free_all(); /* so the child doesn't hold the parent's fd's open */
@@ -220,7 +220,7 @@
spawn_func(cpuworker_main, (void*)fd);
log_fn(LOG_DEBUG,"just spawned a worker.");
- close(fd[1]); /* we don't need the worker's side of the pipe */
+ tor_close_socket(fd[1]); /* we don't need the worker's side of the pipe */
conn = connection_new(CONN_TYPE_CPUWORKER);
Index: dns.c
===================================================================
RCS file: /home/or/cvsroot/src/or/dns.c,v
retrieving revision 1.82
retrieving revision 1.83
diff -u -d -r1.82 -r1.83
--- dns.c 28 Apr 2004 20:12:44 -0000 1.82
+++ dns.c 28 Apr 2004 21:14:56 -0000 1.83
@@ -455,7 +455,7 @@
int *fdarray = data;
int fd;
- close(fdarray[0]); /* this is the side of the socketpair the parent uses */
+ tor_close_socket(fdarray[0]); /* this is the side of the socketpair the parent uses */
fd = fdarray[1]; /* this side is ours */
#ifndef MS_WINDOWS
connection_free_all(); /* so the child doesn't hold the parent's fd's open */
@@ -509,7 +509,7 @@
spawn_func(dnsworker_main, (void*)fd);
log_fn(LOG_DEBUG,"just spawned a worker.");
- close(fd[1]); /* we don't need the worker's side of the pipe */
+ tor_close_socket(fd[1]); /* we don't need the worker's side of the pipe */
conn = connection_new(CONN_TYPE_DNSWORKER);
More information about the tor-commits
mailing list