Nick Mathewson
b7c2b18bd6
Add a RunTesting option to try to learn link state by creating test circuits, even when SocksPort is off.
...
svn:r1327
2004-03-21 03:03:10 +00:00
Roger Dingledine
3d2c6c7cfa
catch signals in a more portable way, so solaris can catch them too
...
svn:r1324
2004-03-20 23:27:22 +00:00
Nick Mathewson
2ba2f02181
Integrate the new "rephist" [rep(utation) hist(ory)] module to trace
...
successful/failed connections, successful/failed extends, and
connection uptimes.
It's still not done: more tests are needed, and not everything calls
connection/circuit_mark_for_close properly. This skews the results.
Also, there needs to be a 'testing' mode for non-OP ORs, where they
periodically build circuits just to test whether extends work.
svn:r1313
2004-03-20 04:59:29 +00:00
Roger Dingledine
208625ae31
clean up some presentation and comments
...
svn:r1294
2004-03-18 19:22:56 +00:00
Roger Dingledine
74ef3a63ae
bugfix: decrement OR connections from global_bucket too
...
bugfix: don't return immediately for has_pending_tls_data unless
the conn is allowed to read
svn:r1270
2004-03-14 17:06:29 +00:00
Roger Dingledine
703b2d3cf8
refactor bandwidth-control token buckets
...
this is a checkpoint commit; there still remain some
bugs, er, somewhere.
svn:r1269
2004-03-14 16:00:52 +00:00
Roger Dingledine
87797bcde5
get rid of those pesky tabs
...
svn:r1264
2004-03-12 13:00:34 +00:00
Roger Dingledine
623cb0e311
more details when a conn is closed before it's done flushing
...
svn:r1262
2004-03-12 08:16:48 +00:00
Roger Dingledine
52e813951a
start tracking the 'broken pipe' error
...
svn:r1261
2004-03-11 20:15:53 +00:00
Nick Mathewson
9b4203266e
Make OP work on windows! (Also misc logging tweaks)
...
svn:r1258
2004-03-11 06:19:08 +00:00
Nick Mathewson
d877aac5ad
Make windows version correct; initialize windows foolishness so that gethostbyname works.
...
svn:r1250
2004-03-10 06:26:38 +00:00
Roger Dingledine
416993afc1
bugfix: only set conn->hold_open_until_flushed after marking
...
svn:r1245
2004-03-08 01:19:57 +00:00
Roger Dingledine
10cee8b7f7
fix a rare race condition: when we send a cell and then
...
mark an OR connection expired, we might close it before
finishing a flush if the other side isn't reading.
svn:r1240
2004-03-06 06:05:00 +00:00
Roger Dingledine
6c9d78b319
stop asserting that computers always go forward in time
...
it's simply not true
svn:r1236
2004-03-06 01:43:37 +00:00
Roger Dingledine
5e2e6555a2
and a minor patch
...
svn:r1215
2004-03-03 08:48:32 +00:00
Roger Dingledine
419a672222
holding until flush was borked
...
we were never writing anything when hold_open_until_flushed was set,
since conn_write returns early if marked_for_conn is set.
seems a bit better now.
svn:r1214
2004-03-03 08:46:18 +00:00
Roger Dingledine
6022bfea11
better debugging for lonely flushes
...
svn:r1213
2004-03-03 07:26:58 +00:00
Roger Dingledine
3c71d09402
use conn->hold_open_until_flushed for streams
...
and also note/fix a variety of other stream-based bugs
svn:r1210
2004-03-03 06:26:34 +00:00
Nick Mathewson
f4e4dac801
Implement hold_open_until_flushed. I may have missed something important.
...
svn:r1209
2004-03-03 05:08:01 +00:00
Roger Dingledine
8275e2302c
make socks5 not give a spurious warning
...
also rename AP_CONN_STATE_CONNECTING to _CONNECT_WAIT
svn:r1208
2004-03-03 04:54:16 +00:00
Nick Mathewson
5a053a6a81
remove redundant check
...
svn:r1204
2004-03-03 02:14:35 +00:00
Nick Mathewson
6379dbbe2a
warn more when losing data on closed/marked connections.
...
svn:r1203
2004-03-03 02:07:57 +00:00
Nick Mathewson
6f3c6d1289
Split out mark_for_close with circuits. Seems to work for me.
...
svn:r1197
2004-03-02 17:48:17 +00:00
Roger Dingledine
2c341cd032
put switch_id and start_daemon earlier
...
svn:r1188
2004-02-29 22:34:38 +00:00
Roger Dingledine
ef5f917e9e
print a statement when the first circ is finished,
...
so the user knows it's working
svn:r1179
2004-02-29 03:52:38 +00:00
Roger Dingledine
4716d4d871
bugfix: only warn about an unrouter router after we've fetched a directory
...
svn:r1178
2004-02-29 01:31:33 +00:00
Roger Dingledine
928db6dadc
cwd to datadir if it's defined, rather than /
...
this way people can get cores if they want to
svn:r1171
2004-02-28 23:23:06 +00:00
Nick Mathewson
f039eca658
Stop trying to flush on broken sockets marked for close.
...
svn:r1163
2004-02-28 19:14:11 +00:00
Roger Dingledine
80410fa8dc
some comments to point nick at the latest bugs
...
svn:r1162
2004-02-28 11:48:22 +00:00
Roger Dingledine
e59f19ca03
some more small fixes
...
svn:r1152
2004-02-28 04:44:48 +00:00
Nick Mathewson
b4a7883c90
make code more readable; arrbitrarily change a -1 to a 0.
...
svn:r1151
2004-02-28 04:34:27 +00:00
Nick Mathewson
4e89c6661a
Push responsibility for connection marking down as far as possible; have only a close path; add some missing end cells; change return conventions a little.
...
svn:r1149
2004-02-28 04:11:53 +00:00
Roger Dingledine
611f117ce1
patches/answers to nick's commit
...
svn:r1146
2004-02-27 23:23:33 +00:00
Nick Mathewson
c5bbb571d2
Refactor mark_for_close, connection_edge_end and friends. Now, everybody
...
who wants to shut down a connection calls connection_mark_for_close instead
of setting marked_for_close to 1. This automatically removes the connection
from the DNS cache if needed, sends a RELAY END cell if appropriate, and can
be changed to do whatever else is needed.
Still to do:
- The same for circuits, maybe.
- Add some kind of hold_connection_open_until_flushed flag, maybe.
- Change stuff that closes connections with return -1 to use mark_for_close,
maybe.
svn:r1145
2004-02-27 22:00:26 +00:00
Roger Dingledine
195dfd35a8
Fix a bug where you might flush some data on a tls connection, and then
...
add some more data to be flushed but never turn POLLOUT on. not sure
how commonly this bug was hit, but it would be a doozy.
Also add some asserts to see if it happens elsewhere.
svn:r1142
2004-02-27 04:42:14 +00:00
Roger Dingledine
4c48359ece
break out the operations done on sighup into their own function
...
svn:r1129
2004-02-26 22:30:44 +00:00
Roger Dingledine
43156904ce
dump a new router.desc on hup
...
svn:r1128
2004-02-26 22:20:00 +00:00
Roger Dingledine
0b27ae0c2d
if the default torrc isn't there, just use some default defaults
...
plus provide an internal dirservers file if they don't have one
having no config files will make it easier to run on windows
svn:r1124
2004-02-26 21:25:51 +00:00
Nick Mathewson
67a273962a
On OSX, decline to use the built-in select-baed poll wrapper, since it seems to sometimes not work.
...
svn:r1114
2004-02-20 23:41:45 +00:00
Roger Dingledine
afdaff63ef
turn some knobs, add more debugging
...
svn:r1023
2004-01-30 19:31:39 +00:00
Roger Dingledine
3516ae1a26
add an ap_conn connecting state; report connecting delay
...
svn:r1011
2004-01-20 09:21:46 +00:00
Roger Dingledine
fb81a32c68
setuid to User _before_ complaining about running as root
...
svn:r1006
2004-01-19 06:12:32 +00:00
Roger Dingledine
561c6236af
fix some errors in logs and comments
...
svn:r999
2004-01-16 08:27:17 +00:00
Roger Dingledine
5086300815
split the token bucket into 'rate' and 'burst' params
...
we're not entirely migrated to burst yet, for backward compatibility
note some win32 probable-bugs
clean up routerlist.c
svn:r982
2004-01-10 23:40:38 +00:00
Roger Dingledine
607078cf70
print an entry at the top of the logfile so you know it's working
...
clean up a minor bug in a debugfile log entry
svn:r970
2004-01-05 05:22:04 +00:00
Nick Mathewson
cacacfe2b1
Integrate new daemon code, adapted from submission by christian grothoff
...
svn:r969
2004-01-03 22:40:49 +00:00
Roger Dingledine
55a94cd497
correct a warn message in mark_if_closed
...
svn:r956
2003-12-23 07:42:01 +00:00
Roger Dingledine
a5aa80cc41
make --debuglogfile (or any second log file) work
...
svn:r935
2003-12-14 09:58:43 +00:00
Roger Dingledine
36ea39ec9c
on hup, close and rebind listener ports too (in case their config has changed)
...
svn:r926
2003-12-14 06:03:46 +00:00
Roger Dingledine
2997ef8dd9
warn if you're running tor as root
...
svn:r921
2003-12-14 04:39:23 +00:00
Roger Dingledine
25e7e97d73
on HUP, retry OR connections, and stop clobbering the dirserver's routerlist
...
svn:r920
2003-12-14 04:33:18 +00:00
Roger Dingledine
c25fbd2676
break routers.c into router.c for stuff the router does,
...
and routerlist.c for handling routerlist.
svn:r887
2003-12-06 05:54:04 +00:00
Roger Dingledine
e0952d0773
terminology shift:
...
directory is the string that dirserv.c and directory.c deal with
routerlist is routerinfo's that are bundled together in routers.c
rename some of the get_routerlist functions to set_routerlist
preparing to break into router.c for stuff the router does,
and routerlist.c for handling routerlist.
svn:r886
2003-12-05 09:51:49 +00:00
Roger Dingledine
975bb68010
simplify: options.OnionRouter==1 iff options.ORPort>0
...
svn:r857
2003-11-20 17:49:45 +00:00
Roger Dingledine
d6601f8cff
make pidfile default to null rather than writing to your cwd
...
svn:r853
2003-11-19 22:45:06 +00:00
Nick Mathewson
fd07872a72
Separate failure-count tracking from circuit-launching.
...
Increment failure counts only when circuits close without having been built.
Reset failure counts only on the second, and when circuits are done building.
svn:r847
2003-11-19 02:22:52 +00:00
Peter Palfrader
9a676b04dd
Check that we can write to the logfile and log a warning to stderr if we can't
...
Move writing of pidfile after daemonizing, and also after setting the [ug]id:
This means that the tor user needs write priviliges to the pidfile location.
It needs it for unlinking the pidfile anyway.
svn:r846
2003-11-19 02:09:43 +00:00
Roger Dingledine
f0cccc567e
bugfix: don't ask for ->next of an expired circuit
...
bugfix: keep going when a circ fails in circuit_n_conn_open
(make circuit_enumerate_by_naddr_nport obsolete)
bugfix: make circuit_n_conn_open only look at circ's that start at us
bugfix: only try circuit_n_conn_open if we're an OP. Otherwise we
expect connections to always already be up.
bugfix: when choosing path length, pay attention to whether the directory
says a router is down.
bugfix: when picking good exit, skip routers which are known to be down
(more work needs to be done on this one)
svn:r838
2003-11-18 09:53:03 +00:00
Roger Dingledine
a3e39b0ceb
don't build too many circs at once
...
expire circs that have been building for too long
svn:r835
2003-11-18 07:48:00 +00:00
Roger Dingledine
4aede010b9
recognize in-progress circs and don't start redundant ones
...
quickly notice streams that don't have a circ on the way, and start one
svn:r819
2003-11-17 00:57:56 +00:00
Roger Dingledine
6d0e611fde
change when circuits are built and expired
...
not quite happy with it yet
svn:r817
2003-11-16 21:49:52 +00:00
Roger Dingledine
fe856406be
initial patches on patches
...
svn:r814
2003-11-16 17:00:02 +00:00
Roger Dingledine
56cd147eb9
let getconfig survive repeated calls. now we call it again when we hup.
...
change RecommendedVersions into a config option, so dirservers can hup
for a new one
svn:r809
2003-11-13 06:49:25 +00:00
Roger Dingledine
aac29076da
warn on startup that we don't provide anonymity
...
make exit dns cache entries last 15 minutes
svn:r807
2003-11-13 04:51:34 +00:00
Roger Dingledine
52589289fe
add DirBindAddress, parse the BindAddress's when you bind
...
exit if bind fails
add usage printfs
rearrange config options for readability
svn:r674
2003-10-25 12:01:09 +00:00
Steven Hazel
4139c1c86a
- fixed a bug in the id switching code -- setgid has to happen before
...
setuid, because after we setuid we don't have the priviledges we
need to setgid anymore, duh. merged switch_user() and
switch_group() into switch_id(), since that code has to be wound
together.
- return -1 from switch_id() if it's not defined to do anything else.
- moved daemoinize(), write_pidfile(), and switch_id() from main.c to
util.c
svn:r656
2003-10-22 11:21:29 +00:00
Steven Hazel
b1eca56b77
added User and Group options -- if you set them, tor will try to
...
setuid and setgid respectively, and die if it can't.
(If the User option is set, tor will setgid to the user's gid as well.)
This happens after the pidfile is created, so that in cases where tor
needs to be root to work with the pidfile, it will at least be able to
create it, although it won't be able to delete it. That sucks, but
it's somewhat better than not being able to create the pidfile in the
first place.
svn:r652
2003-10-22 06:03:11 +00:00
Roger Dingledine
e4127e4d36
move closer to being able to reload config on HUP
...
rename APPort to SocksPort
introduce new tor_free() macro
svn:r642
2003-10-21 09:48:17 +00:00
Roger Dingledine
b40d0bffa7
a skeletal print_usage() function
...
svn:r634
2003-10-20 01:19:54 +00:00
Roger Dingledine
193383b70a
log to stdout while parsing config,
...
otherwise we log to nothing and give no feedback!
svn:r617
2003-10-18 00:13:08 +00:00
Roger Dingledine
0b1afa951e
reload the fingerprints file on HUP
...
svn:r611
2003-10-17 05:23:48 +00:00
Roger Dingledine
b3471bbc55
closing stdout *should* be safe (we'll see)
...
svn:r601
2003-10-15 19:27:51 +00:00
Nick Mathewson
ba9b542e93
Report delivery cell fullness correctly
...
svn:r600
2003-10-15 19:25:28 +00:00
Roger Dingledine
11a23fc280
clean up logging, allow user to specify log files
...
If DebugLogFile is specified, log to it at -l debug
If LogFile is specified, log to it at the -l from the commandline
(default info)
If no LogFile *and* not a Daemon, then log to stdout.
Make conn->s = -1 by default (this might break things)
When kill -USR1, prefer to log at INFO, but make sure they always see it.
svn:r596
2003-10-15 18:50:16 +00:00
Nick Mathewson
7432d97336
Make last commit build
...
svn:r593
2003-10-15 18:37:19 +00:00
Nick Mathewson
959b5585a5
Stop using stdout for non-debugging cases
...
svn:r592
2003-10-15 18:28:32 +00:00
Roger Dingledine
b9628f266f
change WARNING to WARN
...
and fix a few typos
svn:r571
2003-10-10 01:48:32 +00:00
Nick Mathewson
ecfb36823e
Refactor, rename, and clarify
...
svn:r569
2003-10-09 18:45:14 +00:00
Roger Dingledine
746d64e631
add in basic support for pidfiles
...
(patch courtesy aaron turner)
svn:r565
2003-10-08 08:54:52 +00:00
Nick Mathewson
36939303c9
Update LICENSE and copyright dates.
...
svn:r560
2003-10-08 02:04:08 +00:00
Roger Dingledine
756619bfd2
refactor around connection_edge_send_command()
...
svn:r539
2003-10-04 08:19:23 +00:00
Roger Dingledine
be874358a4
wrap strdup; prefer time() to gettimeofday()
...
svn:r538
2003-10-04 03:29:09 +00:00
Roger Dingledine
f563bbd2f9
refactor so connection_write_to_buf() never fails
...
svn:r537
2003-10-04 02:38:18 +00:00
Roger Dingledine
a6bab569ab
socks5 now works
...
(or at least, we can talk to mozilla.)
svn:r536
2003-10-04 01:37:01 +00:00
Nick Mathewson
985a3e1492
Add new cell fullness and bandwidth stats.
...
svn:r533
2003-10-02 20:00:38 +00:00
Roger Dingledine
efa8e288ef
my_routerinfo, router_is_me, and learn_my_address are obsolete
...
ACIs are decided now by strcmp'ing nicknames, rather than comparing addr:port
svn:r529
2003-10-01 01:49:53 +00:00
Nick Mathewson
91cf86d8da
rebuild directory before uploading
...
svn:r528
2003-10-01 01:08:20 +00:00
Nick Mathewson
df5c7534b1
Move dirserv/routers code out of main.c
...
svn:r527
2003-10-01 00:43:34 +00:00
Roger Dingledine
2cfc6f0379
ORs post descriptors periodically too
...
svn:r523
2003-09-30 23:06:23 +00:00
Nick Mathewson
bd7db5bd87
Add "platform" to router descriptors.
...
svn:r522
2003-09-30 22:44:33 +00:00
Roger Dingledine
dc8f40e4cb
fix the SSL_read() bug again. this time for sure!
...
svn:r518
2003-09-30 20:36:20 +00:00
Nick Mathewson
01786266ca
Bugfixes in directory code:
...
Improve debugging output on fingerprint checking.
Make sure to add our own fingerprint to the fingerprint list _before_
adding our own descriptor, or else we'll reject ourself.
Don't call a directory invalid just because we have a newer descriptor
for some router.
Use router_get_dir_hash to generate hashes for signed directories.
Make sure we add our own descriptor successfully.
Don't fall-through on failed base64-endode.
svn:r514
2003-09-30 19:27:54 +00:00
Roger Dingledine
2da3e4da0d
move connection_array accessors from main.c to connection.c
...
(leave poll_array accessors in main.c)
svn:r512
2003-09-30 19:06:22 +00:00
Roger Dingledine
4533da06c9
getting closer to having dirserv working
...
we now add our own descriptor to the descriptor list
and we rebuild the directory (and dump to disk) after receiving a POST
svn:r509
2003-09-30 08:18:10 +00:00
Roger Dingledine
3ed7aedc11
bugfixes and features: closer to making dirserv work
...
fix a variety of seg faults
don't try to list OPs in running-routers
write cached-directory to disk when rebuilding the dir
on boot, dirservers load approved-routers file
on boot, dirservers load cached directory file
svn:r508
2003-09-29 23:14:49 +00:00
Roger Dingledine
467d278b8b
more cleanup and rearranging
...
still not finished integrating new dirserv stuff
svn:r507
2003-09-29 07:50:08 +00:00
Roger Dingledine
5d31f71557
fix two new segfaults
...
svn:r506
2003-09-28 08:06:18 +00:00
Roger Dingledine
c4c66e2c7f
expand the scheduler to address SSL_read()'s pending bytes
...
svn:r505
2003-09-28 06:48:20 +00:00
Nick Mathewson
0e0169d6fa
Write necessary backends for online directory generation. I think.
...
svn:r503
2003-09-27 21:30:10 +00:00
Roger Dingledine
cb8212bfcb
clean up receiver buckets; prepare for payloads in relay_end; note a few bugs
...
svn:r502
2003-09-27 21:09:56 +00:00