aboutsummaryrefslogtreecommitdiff
path: root/src/or/main.c
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2003-06-17 14:31:05 +0000
committerRoger Dingledine <arma@torproject.org>2003-06-17 14:31:05 +0000
commit05a8c264ff4bff8ea13596759b3a4f0ef153041d (patch)
tree62fa3e11086f0454aa4f7ef2b4bba2df2f5a74a9 /src/or/main.c
parentcb8ebfcf294f2b77173b9512bd1c6bc9e87cb030 (diff)
downloadtor-05a8c264ff4bff8ea13596759b3a4f0ef153041d.tar
tor-05a8c264ff4bff8ea13596759b3a4f0ef153041d.tar.gz
overhaul the dns farm: cut its size in half
i've eliminated the master dns process, so now the workers just act like regular connections and are handled by the normal pollarray. everything seems to still work. ;) svn:r327
Diffstat (limited to 'src/or/main.c')
-rw-r--r--src/or/main.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/or/main.c b/src/or/main.c
index 99d827675..c231d57d6 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -168,6 +168,18 @@ connection_t *connection_get_by_type(int type) {
return NULL;
}
+connection_t *connection_get_by_type_state(int type, int state) {
+ int i;
+ connection_t *conn;
+
+ for(i=0;i<nfds;i++) {
+ conn = connection_array[i];
+ if(conn->type == type && conn->state == state)
+ return conn;
+ }
+ return NULL;
+}
+
void connection_watch_events(connection_t *conn, short events) {
assert(conn && conn->poll_index < nfds);
@@ -782,17 +794,13 @@ int tor_main(int argc, char *argv[]) {
exit(1);
log(options.loglevel,NULL); /* assign logging severity level from options */
- if (options.Daemon)
+ if(options.Daemon)
daemonize();
if(options.OnionRouter) { /* only spawn dns handlers if we're a router */
- if(dns_master_start() < 0) {
- log(LOG_ERR,"main(): We're running without a dns handler. Bad news.");
- }
+ dns_init(); /* initialize the dns resolve tree, and spawn workers */
}
- init_cache_tree(); /* initialize the dns resolve tree */
-
signal (SIGINT, catch); /* catch kills so we can exit cleanly */
signal (SIGTERM, catch);
signal (SIGUSR1, catch); /* to dump stats to stdout */