[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] More win32 fixes: 1) tolerate extra "readable" events bette...
- To: or-cvs@freehaven.net
- Subject: [or-cvs] More win32 fixes: 1) tolerate extra "readable" events bette...
- From: nickm@seul.org (Nick Mathewson)
- Date: Mon, 6 Dec 2004 18:19:57 -0500 (EST)
- Delivered-to: archiver@seul.org
- Delivered-to: or-cvs-outgoing@seul.org
- Delivered-to: or-cvs@seul.org
- Delivery-date: Mon, 06 Dec 2004 18:20:21 -0500
- Reply-to: or-dev@freehaven.net
- Sender: owner-or-cvs@freehaven.net
Update of /home/or/cvsroot/tor/src/or
In directory moria.mit.edu:/tmp/cvs-serv2567/src/or
Modified Files:
cpuworker.c dns.c
Log Message:
More win32 fixes: 1) tolerate extra "readable" events better. 2) when being multithreaded, leave parent fdarray open.
Index: cpuworker.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/cpuworker.c,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -d -r1.60 -r1.61
--- cpuworker.c 29 Nov 2004 22:25:30 -0000 1.60
+++ cpuworker.c 6 Dec 2004 23:19:55 -0000 1.61
@@ -125,6 +125,9 @@
tor_assert(conn);
tor_assert(conn->type == CONN_TYPE_CPUWORKER);
+ if (!buf_datalen(conn->inbuf))
+ return 0;
+
if (conn->state == CPUWORKER_STATE_BUSY_ONION) {
if (buf_datalen(conn->inbuf) < LEN_ONION_RESPONSE) /* entire answer available? */
return 0; /* not yet */
@@ -206,9 +209,9 @@
char tag[TAG_LEN];
crypto_pk_env_t *onion_key = NULL, *last_onion_key = NULL;
- 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
+ tor_close_socket(fdarray[0]); /* this is the side of the socketpair the parent uses */
connection_free_all(); /* so the child doesn't hold the parent's fd's open */
#endif
handle_signals(0); /* ignore interrupts from the keyboard, etc */
Index: dns.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/dns.c,v
retrieving revision 1.124
retrieving revision 1.125
diff -u -d -r1.124 -r1.125
--- dns.c 29 Nov 2004 22:25:30 -0000 1.124
+++ dns.c 6 Dec 2004 23:19:55 -0000 1.125
@@ -581,8 +581,8 @@
tor_assert(conn);
tor_assert(conn->type == CONN_TYPE_DNSWORKER);
- if (conn->state != DNSWORKER_STATE_BUSY) {
- log_fn(LOG_WARN,"Bug: poll() indicated than an idle dns worker was readable. Please report.");
+ if (conn->state != DNSWORKER_STATE_BUSY && buf_datalen(conn->inbuf)) {
+ log_fn(LOG_WARN,"Bug: read data from an idle dns worker. Please report.");
return 0;
}
if (buf_datalen(conn->inbuf) < 5) /* entire answer available? */
@@ -653,9 +653,9 @@
int fd;
int result;
- 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
+ tor_close_socket(fdarray[0]); /* this is the side of the socketpair the parent uses */
connection_free_all(); /* so the child doesn't hold the parent's fd's open */
#endif
handle_signals(0); /* ignore interrupts from the keyboard, etc */