Commit Graph

812 Commits

Author SHA1 Message Date
Nick Mathewson
0831823763 Change end-of-file NLNL convention. It turns out arma I and I agree.
svn:r4382
2005-06-09 19:03:31 +00:00
Nick Mathewson
a6f51001a5 New whitespace normalization rule: no blank line at EOF.
svn:r4378
2005-06-09 16:46:51 +00:00
Roger Dingledine
eeb6d6dba6 dump periodic memory usage stats
svn:r4348
2005-06-08 17:24:58 +00:00
Roger Dingledine
aff308e6d9 reenable the part of the code that tries to flush as soon as an OR outbuf
has a full tls record available. perhaps this will make OR outbufs not grow
as huge except in rare cases, thus saving lots of cpu time plus memory.


svn:r4343
2005-06-08 04:55:06 +00:00
Roger Dingledine
1a5c5452b4 when you send a USR2 signal, the log message now tells you to send
a HUP signal if you want to change back to old log levels.


svn:r4332
2005-06-07 18:16:14 +00:00
Nick Mathewson
2118e5798a Use correct errno from libevent on win32
svn:r4327
2005-06-07 17:32:33 +00:00
Nick Mathewson
e1c8aa8035 Fix win32 compilation: backport candidate
svn:r4320
2005-06-06 20:06:10 +00:00
Nick Mathewson
fc40f974c2 When RNG seeding fails, die. Backport candidate
svn:r4319
2005-06-06 20:02:33 +00:00
Nick Mathewson
baa10cbbfa Instrument buffers.c and rephist.c memory usage
svn:r4317
2005-06-06 17:03:21 +00:00
Roger Dingledine
4855990d37 clean up a few more log entries
svn:r4304
2005-05-27 17:43:43 +00:00
Roger Dingledine
bfc7838b97 downgrade the 'caught sigpipe' notice.
we're going to pretend like all of these are fine.


svn:r4301
2005-05-25 02:20:15 +00:00
Roger Dingledine
4f0d7b82ae make lucky's weird libevent poll einprogress bug just warn, not kill tor.
svn:r4300
2005-05-24 22:58:57 +00:00
Nick Mathewson
d2cdae221d Fix not-freed-on-exit event
svn:r4298
2005-05-24 17:13:15 +00:00
Roger Dingledine
5005f682ae Bugfix: we were checking to see if you want to send a keepalive, based
on five minutes since last successful write. But if you have bytes queued
already, and they're not getting through, we were adding a new keepalive
every second. This was bad.


svn:r4296
2005-05-23 22:20:54 +00:00
Roger Dingledine
040a748d87 i screwed up the dirport reachability testing when we don't yet
have a cached version of the directory. hopefully now fixed.


svn:r4284
2005-05-23 05:20:52 +00:00
Nick Mathewson
11a64692c3 Make hashed controller password encoding use hex not base64; this makes it possible to write a controller without base64
svn:r4279
2005-05-23 02:31:53 +00:00
Roger Dingledine
c95677725a a note for nick about other memory not freed at exit
svn:r4275
2005-05-20 22:11:46 +00:00
Roger Dingledine
2812d4a08c free some memory that is still reachable on exit
svn:r4234
2005-05-16 10:32:10 +00:00
Roger Dingledine
28195a0eb1 clean up some log entries
svn:r4228
2005-05-15 05:00:24 +00:00
Roger Dingledine
b92a77b1d2 move the periodic buffer shrinking interval from 3 mins to 1 min
svn:r4204
2005-05-14 01:11:45 +00:00
Nick Mathewson
bc51c8b074 Implement --verify-config command-line option to fix bug 69.
svn:r4182
2005-05-07 04:49:09 +00:00
Roger Dingledine
cc0b19888d log buffer sizes on kill -usr1 too.
svn:r4180
2005-05-06 08:32:37 +00:00
Roger Dingledine
5265bbd2b8 first iteration of scrubbing sensitive strings from logs.
also generally clean up log messages.


svn:r4174
2005-05-03 10:04:08 +00:00
Nick Mathewson
b35f7dacef Call tor_free_all instead of connections_free_all after forking
svn:r4173
2005-05-03 03:51:20 +00:00
Nick Mathewson
a312ce1d3b Change buffer shrinking strategy: only try to shrink once every 3 minutes. Do not try to read over buffer size unless buffer is nearly empty.
svn:r4165
2005-05-02 23:17:08 +00:00
Roger Dingledine
509405a5f7 clean up this TOR_FRAGILE business
svn:r4116
2005-04-26 18:52:16 +00:00
Roger Dingledine
4fafa81f32 help debug: when we close a conn due to timeout, tell us its
file descriptor, not its connectionarray index.


svn:r4113
2005-04-25 17:24:16 +00:00
Nick Mathewson
cf84759b4b zero-out errno before calling event_dispatch, just in case we have misdiagnosed poll(2)/EINVAL bug.
svn:r4081
2005-04-17 22:38:39 +00:00
Roger Dingledine
e2cdc87485 remove some redundant code
svn:r4062
2005-04-08 06:16:09 +00:00
Nick Mathewson
b897cb1ec3 Change conn_(type|state)_to_string from const arrays to switch functions so we (I) will not make Tor crash the next time we (I) add a new state.
svn:r4045
2005-04-07 20:25:22 +00:00
Roger Dingledine
46089c49c4 blow away most calls to assert_all_pending_dns_resolves_ok, since
they're eating our cpu.


svn:r4034
2005-04-06 20:05:34 +00:00
Roger Dingledine
9cbaf4603d fix an assert trigger: when we have the rare case of accepting
a conn on 0.0.0.0:0, then when we look through the connection array,
we'll find any of the workers. this is no good.


svn:r4027
2005-04-06 15:19:32 +00:00
Nick Mathewson
055ee7c323 Give better warnings if connection_close_unattached_ap gets called twice or called on a marked connection; rename it to connection_mark_unattached_ap.
svn:r3990
2005-04-02 22:11:24 +00:00
Nick Mathewson
0e81265359 update copyright notices.
svn:r3982
2005-04-01 20:15:56 +00:00
Nick Mathewson
efe9ca659a Use recent libevent features when possible
svn:r3940
2005-04-01 02:37:40 +00:00
Roger Dingledine
1f5c8335e8 still publish your descriptor if orport is reachable but dirport isn't
when building testing circs for orport testing, require high-bandwidth
nodes, so fewer circs fail. complain about unreachable orport separately
from unreachable dirport.


svn:r3935
2005-03-31 19:26:33 +00:00
Roger Dingledine
20a8eda31b don't check for reachability, and don't whine about it, while we're
hibernating.


svn:r3919
2005-03-29 03:48:31 +00:00
Roger Dingledine
9b5432214d but only do the rapid reachability testing if we're hoping to be a server.
svn:r3902
2005-03-27 11:52:15 +00:00
Roger Dingledine
92acd64da0 if your server hasn't found itself to be reachable, complain every
20 minutes, not just once.


svn:r3897
2005-03-27 06:50:36 +00:00
Roger Dingledine
7a79acd9f6 clean up socks reply stuff more.
add a few more reasons so we can be more informative.


svn:r3895
2005-03-27 06:37:56 +00:00
Roger Dingledine
36baf7219d stop most cases of hanging up on a socks connection without sending
the socks reject. audit for remaining ones. also make things more
uniform so we always remember to hold-open-until-flushed, etc.


svn:r3891
2005-03-27 04:55:13 +00:00
Roger Dingledine
b8d38dc57b try harder to establish reachability, in the first 20 minutes
of uptime.


svn:r3884
2005-03-26 05:54:50 +00:00
Roger Dingledine
1328383482 make it clearer to the human that his server is testing
its reachability. tell him when it succeeds, or when 20
minutes pass and it hasn't succeeded yet.


svn:r3882
2005-03-26 01:43:39 +00:00
Roger Dingledine
570da8a8e8 and fill in another missing socks reply
svn:r3877
2005-03-25 11:23:03 +00:00
Roger Dingledine
8945df8daa remove dead code
svn:r3875
2005-03-25 10:55:49 +00:00
Nick Mathewson
4ee6addf57 Fix bug 44: on HUP, if descriptor building fails (say, because router_get_my_address() fails), use old descriptor and warn.
svn:r3839
2005-03-23 20:28:40 +00:00
Roger Dingledine
21b1adefbb fix a 32bit/64bit sprintf mixup that weasel pointed out
svn:r3823
2005-03-22 23:27:29 +00:00
Nick Mathewson
ab1d0049a2 Prevent spurious closes when we put stuff on a conn that has not written for a while.
svn:r3816
2005-03-22 20:25:51 +00:00
Roger Dingledine
8a763b5ae3 cleanup and a question
svn:r3815
2005-03-22 20:04:00 +00:00
Nick Mathewson
2d662bf773 Clear up a couple of pedantic compiler warnings
svn:r3812
2005-03-22 18:56:11 +00:00
Nick Mathewson
c4470cbedf be more explicit about why we are expiring a conn; improve logic a bit too
svn:r3808
2005-03-22 06:21:35 +00:00
Roger Dingledine
4a497e5030 if our clock jumps forward by 100 seconds or more, assume something
has gone wrong with our network and abandon all not-yet-used circs.


svn:r3792
2005-03-19 23:58:42 +00:00
Roger Dingledine
856ab90ca8 stop logging at -l notice every single time a create cell successfully
gets processed


svn:r3791
2005-03-19 23:04:15 +00:00
Nick Mathewson
b004eda10c Enable NT service code by default
svn:r3780
2005-03-19 01:04:05 +00:00
Nick Mathewson
df9c8feac7 Commit fixes for several pending tor core tasks: document all DOCDOCed functions; time out uncontrolled unattached streams; feed reasons to SOCKS5 (refactoring connection_ap_handshake_socks_reply in the process); change DirFetchPeriod/StatusFetchPeriod to have a special "Be smart" value.
svn:r3769
2005-03-17 12:38:37 +00:00
Nick Mathewson
0197b47ce9 Fix some more obscure compiler warnings
svn:r3758
2005-03-14 03:28:46 +00:00
Nick Mathewson
97dad670ea Renormalize whitespace
svn:r3757
2005-03-14 03:18:35 +00:00
Nick Mathewson
777d3dde0c Get address map resetting implemented.
svn:r3745
2005-03-11 21:39:39 +00:00
Nick Mathewson
e14f812a67 Still more code to make sure we send the right number and kind of RELAY END cells
svn:r3723
2005-03-02 03:13:05 +00:00
Nick Mathewson
349ee1abea Clean up rend cache on shutdown
svn:r3714
2005-02-28 22:38:00 +00:00
Nick Mathewson
97bc49bd72 Try a little harder to avoid openssl SSL* double-free reports.
svn:r3710
2005-02-28 02:52:51 +00:00
Roger Dingledine
b3177d509e free some more memory at shutdown
svn:r3707
2005-02-28 01:59:18 +00:00
Roger Dingledine
a1f1fa6ab2 Checkpoint in-progress fixes:
Add 'testing' circuit purpose, for reachability testing.
Notice when our IP changes, and reset stats.
Try to pull down a directory via Tor to see if our DirPort is working.
Try to extend a circuit back to us to see if our ORPort is working.
Only publish a descriptor if they're both reachable.

These mostly work, and I'd better get them in before I cause conflicts.


svn:r3703
2005-02-27 09:47:01 +00:00
Nick Mathewson
26e6eb7539 Check returns from libevent calls better; stop poking at internals of events to see if they are live.
svn:r3691
2005-02-25 05:42:01 +00:00
Nick Mathewson
2ff6cfccd6 Forward-port fix to make dual-purpose NT executable work.
svn:r3665
2005-02-23 05:34:25 +00:00
Roger Dingledine
55c3f15ed1 Forward-port the trick to bump up ConnLimit as far as it can
go, but not past MAXCONNECTIONS. Also throw away the FAKE_POLL
caveats since 0.1.0 doesn't need it any more.


svn:r3657
2005-02-22 23:52:44 +00:00
Nick Mathewson
1a55422006 Fix windows build: juggle }s and #endifs around in main.c
svn:r3645
2005-02-22 02:57:43 +00:00
Roger Dingledine
8727acf2f1 Add a new AddressMap directive to rewrite incoming socks addresses.
Add a new TrackHostExits directive to trigger addressmaps for
certain incoming socks addresses, for sites that break when your exit
keeps changing.
Redo the client-side dns cache so it's just an addressmap too.


svn:r3641
2005-02-22 00:53:08 +00:00
Nick Mathewson
5d836c8140 Free tls resources on exit too
svn:r3615
2005-02-11 01:41:19 +00:00
Nick Mathewson
f672577bc6 Free even more things on shutdown. Temporarily move tor_free_all out from #ifdef so it gets tested more.
svn:r3614
2005-02-11 01:26:47 +00:00
Nick Mathewson
60f234f42b Add more functions to free things to help dmalloc allong.
svn:r3613
2005-02-10 23:18:39 +00:00
Roger Dingledine
c5c46d6fb6 don't list version in the win32 service display name or service name,
since they'll keep changing and people will get messed up about which
one is installed.


svn:r3592
2005-02-09 02:26:24 +00:00
Nick Mathewson
bb32fa86d7 Re-normalize whitespace; make "make check-spaces" happy
svn:r3566
2005-02-05 21:42:46 +00:00
Nick Mathewson
24ad6542c9 forward-port NT service patch
svn:r3565
2005-02-05 21:40:25 +00:00
Roger Dingledine
bcece3d8a7 another minor fix
svn:r3511
2005-02-03 07:30:00 +00:00
Peter Palfrader
ddd724ef94 Add --with-dmalloc configure option
svn:r3508
2005-02-03 07:25:10 +00:00
Peter Palfrader
dfa3a0220f Write a function header for Roger so he can fill it with life
svn:r3507
2005-02-03 07:23:48 +00:00
Roger Dingledine
0f5a198028 sometimes, a conn on the closeable_lst gets absolutely
clobbered. maybe this will help me find out why.


svn:r3498
2005-02-02 00:19:09 +00:00
Roger Dingledine
2e97593d25 define TOR_FRAGILE if you want tor to give you a core when
something goes wrong. this should only be used by people actively
tracking bugs.


svn:r3487
2005-02-01 00:37:16 +00:00
Roger Dingledine
d6489d8e41 lay a trap for situations where we connection_free something
that's still on one of the lists.

in particular, this will detect situations where we mark-for-close
and then free it ourselves.


svn:r3475
2005-01-31 00:33:32 +00:00
Roger Dingledine
75b45bcd4d stop the infinite loop of freeing the same connection_t over and
over when it's not linked into the connection_array


svn:r3474
2005-01-31 00:26:09 +00:00
Roger Dingledine
3969b6066e Stop crashing when we're asking to close_if_marked a conn that
hasn't been connection_added yet. This happens when an exit conn
is in dns_wait and we get a relay end cell for it before it finishes.

We were silently leaking each of these marked conns in 0.0.9.x. Now
we actually free them.


svn:r3470
2005-01-30 21:47:47 +00:00
Roger Dingledine
7ddeb7fae7 try to find the corrupt closeable_connection_lst entry early
svn:r3468
2005-01-30 20:31:08 +00:00
Roger Dingledine
8e7fc8d259 comment about a bug wrt clock skew
svn:r3461
2005-01-30 00:07:31 +00:00
Roger Dingledine
b2fbd834f0 forward-port the dns and maxconn fixes
svn:r3448
2005-01-28 08:53:47 +00:00
Nick Mathewson
e03f571ee3 Forward-port win32 service patch; try to clean it a touch.
svn:r3438
2005-01-27 21:45:32 +00:00
Nick Mathewson
6704093c0d Appease another 64-bit warning
svn:r3392
2005-01-20 20:21:34 +00:00
Nick Mathewson
5b45527851 Appease weasel's paranoid 64-bit compiler.
svn:r3389
2005-01-20 20:16:48 +00:00
Roger Dingledine
d2400a5afd Introduce a notion of 'internal' circs, which are chosen without regard
to the exit policy of the last hop. Intro and rendezvous circs must
be internal circs, to avoid leaking information. Resolve and connect
streams can use internal circs if they want.

New circuit pooling algorithm: make sure to have enough circs around
to satisfy any predicted ports, and also make sure to have 2 internal
circs around if we've required internal circs lately (with high uptime
if we've seen that lately).

Split NewCircuitPeriod config option into NewCircuitPeriod (30 secs),
which describes how often we retry making new circuits if current ones
are dirty, and MaxCircuitDirtiness (10 mins), which describes how long
we're willing to make use of an already-dirty circuit.

Once rendezvous circuits are established, keep using the same circuit as
long as you attach a new stream to it at least every 10 minutes. (So web
browsing doesn't require you to build new rend circs every 30 seconds.)

Cannibalize GENERAL circs to be C_REND, C_INTRO, S_INTRO, and S_REND
circ as necessary, if there are any completed ones lying around when
we try to launch one.

Re-instate the ifdef's to use version-0 style introduce cells, since
there was yet another bug in handling version-1 style. We'll try switching
over again after 0.0.9 is obsolete.

Bugfix: when choosing an exit node for a new non-internal circ, don't take
into account whether it'll be useful for any pending x.onion addresses --
it won't.

Bugfix: we weren't actually publishing the hidden service descriptor when
it became dirty. So we only published it every 20 minutes or so, which
means when you first start your Tor, the hidden service will seem broken.


svn:r3360
2005-01-17 18:13:09 +00:00
Nick Mathewson
a38bccdca7 Move call to event_init() immediately after start_daemon(); move start_daemon earlier. This should fix using libevent with RunAsDaemon.
svn:r3354
2005-01-13 21:32:08 +00:00
Roger Dingledine
abea142665 more cleanup
svn:r3347
2005-01-12 12:22:25 +00:00
Roger Dingledine
24a97d2c55 fix up some comments
svn:r3345
2005-01-12 12:18:46 +00:00
Roger Dingledine
3809c0ab91 tolerate bandwidtch buckets going negative (i hope)
svn:r3344
2005-01-12 10:00:38 +00:00
Nick Mathewson
324b192f68 Make Tor use Niels Provos's libevent instead of it's current
poll-but-sometimes-select mess.  This will let us use faster async cores
(like epoll, kpoll, and /dev/poll), and hopefully work better on Windows
too.

There are some fairly nasty changes to main.c here; this will almost
certainly break something.  But hey, that's what alphas are for.


svn:r3341
2005-01-12 06:42:32 +00:00
Roger Dingledine
70b3208f0a if somebody starts his tor server in jan 2004 and then fixes his
clock, don't make his published uptime be a year.


svn:r3337
2005-01-11 11:54:11 +00:00
Roger Dingledine
4b6d55afdf separate time_of_process_start from stats_n_seconds_uptime:
now we reset uptime when a dir fetch entirely fails. this
hopefully has something to do with stability of being on the
network.


svn:r3333
2005-01-10 05:10:22 +00:00
Roger Dingledine
3370f53010 it helps to use the correct name for the struct
svn:r3331
2005-01-10 04:32:59 +00:00
Roger Dingledine
10a81ccf18 when pruning circuit-wait streams when a dir fetch failed,
refer in logs to the destination address, not the address of the
application connection.


svn:r3330
2005-01-10 02:47:50 +00:00
Roger Dingledine
f468ff04ea when we haven't fetched a directory yet, or the last time we
tried they were all unreachable, assume we are not connected to
the network.

when an application request comes in during this state, be
optimistic and assume we just reconnected. fetch a new directory
and if it works, begin making circuits.


svn:r3327
2005-01-07 15:57:57 +00:00
Roger Dingledine
f8b517fa97 finish marking my comment in main.c
svn:r3318
2005-01-06 19:20:54 +00:00
Roger Dingledine
1f51809e65 clean up string printing in relay logs
svn:r3317
2005-01-06 19:19:13 +00:00
Nick Mathewson
dcd228585d Implement SIGNAL control command.
svn:r3307
2005-01-05 06:40:47 +00:00
Nick Mathewson
0c4186d6ee Use correct logic to decide whether there are more directory servers to retry.
svn:r3257
2005-01-03 20:51:24 +00:00
Roger Dingledine
e1ac30c2bb stop calling assert_connection_ok(conn, time(NULL)) on every single
conn on every single loop.


svn:r3229
2004-12-25 06:43:40 +00:00
Roger Dingledine
288f2ed59e stop telling win32 folks they have a bug just because we haven't finished
making tor work on win32 yet.


svn:r3227
2004-12-25 06:42:15 +00:00
Roger Dingledine
cf17d0d29c move network_init from or/main to common/compat
call network_init in tor-resolve.c too
move tor_lookup_hostname from common/util to common/compat


svn:r3203
2004-12-22 05:29:06 +00:00
Roger Dingledine
036384fd8e respond to an 009 XXX
svn:r3201
2004-12-22 02:55:26 +00:00
Nick Mathewson
e327b2f3a6 Clarify confusing message
svn:r3151
2004-12-16 05:23:48 +00:00
Roger Dingledine
a8582ae223 note a future thing we should do
svn:r3141
2004-12-13 01:30:41 +00:00
Roger Dingledine
011ad3cba5 clean up logging,
make it clearer which warns are bugs,
make the control log event match its specification,
point out a bug in how we deal with failure when renewing the tls context.


svn:r3138
2004-12-13 00:44:39 +00:00
Nick Mathewson
972124aab9 Only launch dns workers when we are actually starting a server.
svn:r3137
2004-12-13 00:09:00 +00:00
Roger Dingledine
29a8e80326 log bytes written with kill -USR1 too
svn:r3112
2004-12-07 16:50:47 +00:00
Roger Dingledine
41b809d2aa salvage another 300 bytes per hup
svn:r3106
2004-12-07 09:11:38 +00:00
Nick Mathewson
ac759adb43 Make unit tests work on win32
svn:r3094
2004-12-07 05:31:38 +00:00
Nick Mathewson
b457cfb5eb Spell-check strings and comments
svn:r3052
2004-12-01 03:48:14 +00:00
Roger Dingledine
bde1d5bfb2 do even less inside our signal handler,
just to be extra paranoidly safe


svn:r3050
2004-12-01 02:54:13 +00:00
Roger Dingledine
1d4af1930c Let resolve conns retry/expire also, rather than sticking around forever.
Put the check-if-requested-exitrouter-will-reject-us code in the
circuit_attach loop, so it gets checked periodically and not just
once at the beginning. This is useful in case the routerlist changes,
but also in case the address gets resolved into something that we learn
we'll reject.


svn:r3039
2004-11-30 08:39:14 +00:00
Nick Mathewson
7fbd297532 Suggestion from weasel: Make tor --version --version dump the cvs Id of every file.
svn:r3019
2004-11-29 22:25:31 +00:00
Roger Dingledine
22727b4edc wrong is ok, and right is fine, but in between is apparently
totally unacceptable to me.


svn:r3005
2004-11-28 11:39:53 +00:00
Nick Mathewson
6f5dbefa7e Normalize space: add one between every control keyword and control clause.
svn:r3003
2004-11-28 09:05:49 +00:00
Nick Mathewson
f77ff938b7 remember; tor_socket_errno has side effects!
svn:r2997
2004-11-28 05:48:02 +00:00
Roger Dingledine
e5e45fe980 inform him more sanely
svn:r2993
2004-11-26 04:19:03 +00:00
Roger Dingledine
a7f92d7ffe inform the user that you noticed when he sent a USR2
svn:r2992
2004-11-26 04:17:57 +00:00
Roger Dingledine
f9a0ab62b7 if you want to handle -USR2, you should catch it too.
svn:r2990
2004-11-26 04:03:19 +00:00
Roger Dingledine
7c9a707900 remove emacs droppings, since nick says he doesn't need them anymore
svn:r2989
2004-11-26 04:00:55 +00:00
Nick Mathewson
f91152ce6a Clarify a bunch of log messages
svn:r2983
2004-11-25 04:20:10 +00:00
Roger Dingledine
090c84627c patch to nick's patch
svn:r2969
2004-11-24 03:58:45 +00:00
Nick Mathewson
74f74a06c6 make nt service version match actual version
svn:r2968
2004-11-24 00:55:39 +00:00
Roger Dingledine
57a392d8d8 initialize rephist before we init_from_config, since init_from_config
can make us init_keys if we're going to hibernate, which makes us build
a router_desc.


svn:r2953
2004-11-23 09:00:55 +00:00
Nick Mathewson
f17c08beed Apply NT service patch from Osamu Fujino. This still has some problems (indicated in a comment adapted from the patch submission email), but it is better than before and better than nothing.
svn:r2938
2004-11-22 22:10:37 +00:00
Nick Mathewson
bb18d4238f Dont keep rephist info for routers that havent had activity for 24 hours.
svn:r2926
2004-11-21 05:14:46 +00:00
Nick Mathewson
36f4e15e81 Call init_keys() where needed; fix hibernate bug.
svn:r2924
2004-11-21 04:19:04 +00:00
Roger Dingledine
a4b1eb5630 allow StrictEntryNode and StrictExitNode to be singular
svn:r2922
2004-11-20 23:16:03 +00:00
Roger Dingledine
6322287dc1 printfs want carriage returns
svn:r2917
2004-11-20 08:00:57 +00:00
Roger Dingledine
dd19cf6ba3 kill -USR2 now moves all logs to loglevel debug
plus fix some typos


svn:r2914
2004-11-20 07:33:55 +00:00
Roger Dingledine
2e4763655d bugfix: when our poll is interrupted, we believed the revents values.
svn:r2907
2004-11-17 20:26:39 +00:00
Roger Dingledine
4b76fe8036 Break DirFetchPostPeriod into:
- DirFetchPeriod for fetching full directory,
  - StatusFetchPeriod for fetching running-routers,
  - DirPostPeriod for posting server descriptor,
  - RendPostPeriod for posting hidden service descriptors.

Also make sure the hidden service descriptors are at a random
offset from each other, to hinder linkability.


svn:r2889
2004-11-15 09:05:54 +00:00
Nick Mathewson
c909a8a64b Only record bandwidth usage when accounting is enabled
svn:r2886
2004-11-15 04:48:53 +00:00
Roger Dingledine
ee591be3f2 fix a bug in configuring accounting in options_act()
svn:r2881
2004-11-15 04:01:31 +00:00
Nick Mathewson
5109159ff9 Fix compilation. Duh.
svn:r2876
2004-11-14 22:53:51 +00:00
Nick Mathewson
3e6edf20cc Resolve some hibernating-related XXXX009s.
svn:r2875
2004-11-14 22:21:23 +00:00
Nick Mathewson
57536f138a Fetch running-routers.
Split logic to initiate dirfetch, running-routers fetch, and
descriptor post.  arma: There are some XXXs here that raise design
questions which we should solve before the next release.

The biggest problem is this: Right now, the directory is about 50X as
large as running-routers uncompressed, and about 36X as large
compressed.  Assuming:

    - everybody gets the compressed version of everything,

    - everybody gets cached directories from random dirservers and
      uncached r-r from authdirservers

    - everybody downloads r-r at the same rate they now download dirs,

then using r-r from will *increase* authdirserver directory bandwidth usage
if there are significantly more caches than authdirservers.

I think it's safe to leave this in for now, since there aren't 3x36 caching
dirservers, but we should make everybody with a dirport cache running-routers
soon.  But I could be wrong.


svn:r2872
2004-11-14 21:46:40 +00:00
Roger Dingledine
846f71dcca make kill -USR1 work again
svn:r2853
2004-11-14 13:35:47 +00:00
Roger Dingledine
3f5c113815 clean a comment
svn:r2844
2004-11-14 04:55:02 +00:00
Nick Mathewson
08627d5d87 Track whether descriptor is dirty/uploaded. When any options are set, mark it dirty. Once a minute, regenerate and upload the server descriptor if it is dirty.
svn:r2832
2004-11-13 16:53:48 +00:00
Nick Mathewson
0b42e31fe0 Comment a confusing conditional
svn:r2828
2004-11-13 02:54:30 +00:00
Nick Mathewson
60880cda84 Resolve a bunch of FIXME items; mark a lot more for attention; ask for clarification on some. Turn all XXXX008 ("showstopper for 0.0.8 release") items into XXXX009 or XXXX, since plainly they were not showstoppers for 0.0.8. Add/clean some docs.
svn:r2808
2004-11-12 16:39:03 +00:00
Roger Dingledine
90e0ad517e dfc caught a SIGXFSZ error when his debugfile reached 2GB.
so if they exist, catch them and ignore them.
write() will fail normally and we'll look at errno like
normal human beings.


svn:r2804
2004-11-12 04:59:37 +00:00
Roger Dingledine
fde595feb7 when clients do --list-fingerprint, it's misleading to
give them one, because it will never be the same again


svn:r2800
2004-11-11 13:24:10 +00:00
Roger Dingledine
c03a3eaed0 weaken our anonymity warning a little bit more
svn:r2771
2004-11-10 02:58:27 +00:00
Nick Mathewson
5a5be93f80 Normalize whitespace; add a "tell me about all the unnormalized whitespace" target; fix a braino in dirserv.c
svn:r2758
2004-11-09 20:04:00 +00:00
Nick Mathewson
cd753df7bf Resolve many XXXs and all DOCDOCs
svn:r2755
2004-11-09 18:22:17 +00:00
Roger Dingledine
6a504efdd3 mark_logs_temp() before init'ing new ones.
we were seeing double, triple, etc each time we setconf'ed.


svn:r2738
2004-11-09 08:01:39 +00:00
Roger Dingledine
9f3e3d2b71 stop wanting to split init_keys()
svn:r2735
2004-11-09 07:29:05 +00:00
Roger Dingledine
6521c2ce51 Stop using the wrong DataDirectory when we're validating.
Also validate/normalize the DataDirectory better.


svn:r2732
2004-11-09 07:05:53 +00:00
Roger Dingledine
90b47172bd Make an options_act() where we do all the things a new options set
needs.
Still needs more work.


svn:r2716
2004-11-09 04:28:18 +00:00
Roger Dingledine
394554cfbf Clean up copyrights.
Break connection_consider_empty_buckets() out of
connection_read_bucket_decrement().


svn:r2698
2004-11-07 01:33:06 +00:00
Roger Dingledine
efad93feb4 tor --list-fingerprint as a client shouldn't try to print null
svn:r2697
2004-11-06 09:22:08 +00:00
Roger Dingledine
28a297ebe7 only play the accounting game if it's possible you'll choose to hibernate
svn:r2694
2004-11-06 06:56:28 +00:00
Roger Dingledine
6c61ed4fb5 Make options no longer a global variable.
Now we can try setting an option but back out if it fails to parse, or
  if it's disallowed (e.g. changing RunAsDaemon from 1 to 0).
Use parse_line_from_str rather than parse_line_from_file.


svn:r2692
2004-11-06 05:18:11 +00:00
Nick Mathewson
19868fe968 Move accounting code into hibernate; start adding logic to track bandwidth-per-seconds-active
svn:r2680
2004-11-04 22:33:06 +00:00
Roger Dingledine
a4753283dd better interface for connection_ap_handshake_socks_reply()
make --list-fingerprint print the fingerprint again


svn:r2668
2004-11-03 23:13:28 +00:00
Nick Mathewson
cea9125d71 Implement two flavors of authentication for control connections: one for trusted FS, one for untrusted FS.
svn:r2664
2004-11-03 19:49:03 +00:00
Nick Mathewson
451f8b5045 - Implement all of control interface except authentication, setconfig,
and actually making the sockets.
- Make sure that identity-based nicknames start with $.
- Use new string_join interface.


svn:r2661
2004-11-03 18:33:07 +00:00
Nick Mathewson
4fdaa5de51 Streamline the two redundant "Has the second rolled over?" checks in prepare_for_poll and connection_bucket_refill; also, generate BANDWIDTH control events
svn:r2657
2004-11-03 16:38:04 +00:00
Nick Mathewson
d63d420930 Fix another typo
svn:r2651
2004-11-03 01:31:42 +00:00
Nick Mathewson
8db0abb687 First attempt at hibernation code. It needs more work around the XXXXs, but first I want arma to review the basic approach while I meditate on how to fix them.
svn:r2649
2004-11-02 23:47:32 +00:00
Nick Mathewson
ad4dc74482 Use a stricter set of warnings; make them all pass.
svn:r2645
2004-11-02 03:02:17 +00:00
Roger Dingledine
4689243242 make sure options.MaxConn can be reached
svn:r2638
2004-11-01 08:24:34 +00:00
Roger Dingledine
984ffec105 implement first piece of hibernation
still need to track bandwidth, and make decisions based on bandwidth


svn:r2630
2004-10-31 20:28:41 +00:00
Nick Mathewson
9510d9a792 tor --list-fingerprint to print fingerprint and exit
svn:r2627
2004-10-30 19:18:37 +00:00
Nick Mathewson
11d330be5e Tweaks to prevent obsolete restarting tors from hammering the dirservers. (1) Cache a received directory as soon as the signature checks out. (2) Treat a cached directory as "recent" based on its mtime. (3) If we have a recent directory, we dont need to fetch a newer one for DirFetchPostPeriod. This needs review!
svn:r2618
2004-10-28 18:37:52 +00:00
Nick Mathewson
2fbf31533b Tricksy compiler warnings! We hates them, hates them forever, my precious!
svn:r2615
2004-10-27 21:14:11 +00:00
Nick Mathewson
44d4516155 Use tor_snprintf, not snprintf
svn:r2609
2004-10-27 06:37:34 +00:00
Nick Mathewson
bc62f8e983 Replace sprintf with snprintf
svn:r2602
2004-10-27 05:53:07 +00:00
Nick Mathewson
57f09573f5 Every 60 seconds, check whether the listeners are still alive, and relaunch the dead ones.
svn:r2581
2004-10-24 01:22:40 +00:00
Roger Dingledine
54c432bd93 pay attention to the return value of do_hup, and exit
when it fails


svn:r2577
2004-10-23 17:06:25 +00:00
Nick Mathewson
88cffc3c5f Use bitwise masking to turn off bits, not compare-and-subtract
svn:r2572
2004-10-20 23:15:49 +00:00
Roger Dingledine
97a0a43511 start the process of making 0.0.7* obsolete
svn:r2565
2004-10-17 21:51:20 +00:00
Roger Dingledine
de65052312 don't assert multiple things in the same tor_assert()
svn:r2544
2004-10-16 22:14:52 +00:00
Nick Mathewson
1c9426d6e0 Build without warnings on mac gcc 3.3
svn:r2487
2004-10-14 03:18:14 +00:00
Nick Mathewson
b7bddcac75 Windows requires a different cast uint64_t format
svn:r2424
2004-10-07 20:15:56 +00:00
Roger Dingledine
3f4b544b77 use size_t rather than int for directory lengths in memory
this might fix a bug with amd64


svn:r2410
2004-10-01 21:02:12 +00:00
Roger Dingledine
136d4e5739 prefer tor_free to free
plus complain more loudly when we fail to parse a dir we just fetched


svn:r2401
2004-09-29 06:52:36 +00:00
Roger Dingledine
6ed095b177 print the IP if a conn fails badly, to see if there are any trends
svn:r2400
2004-09-29 05:59:55 +00:00
Roger Dingledine
d381aa4696 Fix an evil bug: when we failed to write to our log, fputs()
gave us a sigpipe, and we logged that we were ignoring it,
causing us to fail to log that, and delete the log entry. Then
when the signal handler exited, we proceeded to delete the log
entry that had already been deleted.

Now we make sure to only log inside our signal handler if we'll
be exit()ing right after.


svn:r2388
2004-09-28 21:14:40 +00:00
Roger Dingledine
8727a28119 bugfix: we were starting to daemonize before we opened our logs,
so if there were any problems opening logs, we would complain to
stderr (which wouldn't work) and then mysteriously exit.


svn:r2366
2004-09-23 04:32:43 +00:00
Roger Dingledine
c0db9fa803 fix confusing cut-n-paste mistake
svn:r2364
2004-09-22 04:08:05 +00:00
Nick Mathewson
0ef85f6dba Some platforms have weird translations when you open files in "test" mode; make read/write_str_to_file aware.
svn:r2336
2004-09-08 07:16:34 +00:00
Nick Mathewson
c66e4c4870 Flush more changes from sandbox
- make clients cache directories and use them to seed their router lists
   at startup.  This means clients have a datadir again.
 - Introduce a global_write_bucket.  We need to respond better to exhausting
   it.
 - Remove the last vestiges of LinkPadding and TrafficShaping.
 - Configuration infrastructure support for warning on obsolete options.
 - Refactor directory header parsing to use smartlist_split_string.
 - Respond to content-encoding headers by trying to uncompress as appropriate.
 - Reply with a deflated directory when a client asks for "dir.z".
   (We could use allow-encodings instead, but allow-encodings isn't
   specified in HTTP 1.0.)


svn:r2335
2004-09-08 06:52:33 +00:00
Nick Mathewson
ecf414f05e Stop using separate defaults for no-config-file and empty-config-file
svn:r2329
2004-09-02 22:08:36 +00:00
Nick Mathewson
4b4bfd500a Improve log message to make it obvious _why_ reading the configuration has failed.
svn:r2308
2004-08-24 20:46:42 +00:00
Roger Dingledine
99e367f045 authdirservers don't need to be treated specially on hup for
making intro points


svn:r2277
2004-08-18 06:48:45 +00:00
Roger Dingledine
6e9e467b1d dirservers now don't build circuits until they have fetched a
directory from somebody else. this means they have time to
build their connections first.


svn:r2275
2004-08-18 06:29:58 +00:00
Nick Mathewson
e19af3fa0f We are an OR if ORPort *or* ORBindAddress is set; similarly for being an OP
svn:r2237
2004-08-15 20:16:26 +00:00
Roger Dingledine
cd3da3fc12 o clients choose nodes proportional to advertised bandwidth
o and/or while avoiding unreliable nodes, depending on goals
o 'fascistfirewall' option to pick dirservers on port 80 and ORs on
  port 443.
o if a begin failed due to exit policy, but we believe the IP should                       have been allowed, switch that router to exitpolicy reject *:* until                     we get our next directory.


svn:r2231
2004-08-15 08:15:12 +00:00
Roger Dingledine
dda2e44222 compile again on win32 (i think)
svn:r2222
2004-08-09 23:45:11 +00:00
Roger Dingledine
1e415817a3 minor fix
svn:r2215
2004-08-09 07:41:32 +00:00
Roger Dingledine
7068dd8e87 make "%llu" less likely to warn on weird platforms
svn:r2209
2004-08-09 05:25:19 +00:00
Roger Dingledine
05790d1722 let children survive sigint, sigterm, etc.
this was biting us because ^c would get delivered to all of them,
maybe because they were all still listening to stdin?


svn:r2197
2004-08-08 07:25:45 +00:00
Nick Mathewson
f6cc218742 Refactor ISO-style (yyyy-mm-dd hh:mm:ss) time parsing into util.c; rename format/parse_rfc1123_time; make rephist remember used bandwidth; published used bandwidth in descriptors in 15-minute chunks. Breaks unittests.
svn:r2182
2004-08-07 02:46:16 +00:00
Roger Dingledine
e95ae1c9ad let purging routerinfos and descriptors take an age argument
svn:r2171
2004-08-06 22:15:25 +00:00
Roger Dingledine
967a762fe1 they're uint64 and uint32, not int and int
svn:r2152
2004-08-06 08:40:55 +00:00
Roger Dingledine
f32e34044f list total traffic and total uptime in -usr1 stats
svn:r2151
2004-08-06 08:37:13 +00:00
Roger Dingledine
0c8542d889 fix rare race condition that causes infinite loop
if we get a sigchld but all our children are gone by the time we get
around to reaping them (i don't think this should ever happen, but it
just did), then we'd loop forever trying to reap them.


svn:r2141
2004-08-04 06:49:17 +00:00
Nick Mathewson
75684a48d5 <arma> did you get it working on win32? or just compiling
svn:r2136
2004-08-04 04:58:30 +00:00
Roger Dingledine
a328aab316 clean whitespace and tabs
svn:r2115
2004-07-22 23:21:12 +00:00
Roger Dingledine
aebec8ab9e stop using atexit() to remove our pid, since it's called
immediately when we daemonize.

also drop our retry period for hidserv desc uploads from 10m to 5m


svn:r2111
2004-07-22 22:15:36 +00:00
Roger Dingledine
06b72cc8f2 publish advertised_bandwidth in descriptor
svn:r2095
2004-07-22 04:20:27 +00:00
Roger Dingledine
6c56f34aaf clients shouldn't create datadir until we have something to put there
svn:r2092
2004-07-22 00:13:42 +00:00
Roger Dingledine
3c2c8ed42b 0.0.8 ORs should autoconnect to authdirservers and 0.0.7 servers
svn:r2091
2004-07-21 23:43:47 +00:00
Roger Dingledine
ce7fcd110c solve the authdirserver initialization precedence problem
svn:r2085
2004-07-21 18:53:56 +00:00
Roger Dingledine
3e97c12f24 rearrange to prepare to solve the authdirserver initialization
precedence problem. doesn't actually solve it yet.


svn:r2079
2004-07-21 07:50:06 +00:00
Roger Dingledine
30d6b1479b clients exit immediately on interrupt; they don't wait
svn:r2076
2004-07-21 03:15:32 +00:00
Nick Mathewson
334de84cbe Misc small code cleanups; remove exit_server_mode(); change tor_tls_verify behavior
svn:r2073
2004-07-21 00:44:04 +00:00
Roger Dingledine
73ffcc5cef add a new advertised_server_mode() to distinguish ORs that
are willing to become servers from ones that really are servers.


svn:r2071
2004-07-21 00:12:42 +00:00
Roger Dingledine
0da256ef97 when we get a sigint, don't accept new connections/circuits,
but delay 30 seconds until exiting.
if we get a second sigint, exit immediately.


svn:r2070
2004-07-20 23:31:00 +00:00
Roger Dingledine
d5999a24af also don't hang up on him if we're an OR and he's an authdirserver
otherwise we keep getting taken out of the running-routers list


svn:r2063
2004-07-20 19:45:29 +00:00
Roger Dingledine
66fc6cf04a if you're an OR and he's an OR and he's running 0.0.7,
don't expire your connections to him.


svn:r2062
2004-07-20 19:28:02 +00:00
Roger Dingledine
dc7951a5a7 a whole swath of fixes
introduce an authdir_mode() macro to match the others.
don't initialize uptime to the number of seconds since 1970.
non-authoritative dirservers don't cache their directory on disk.
make only authdirservers use clique_mode.
only read approved-routers file if you're an authdirserver.
even authdirservers fetch a new directory in do_hup.
retry_all_connections() is now called retry_all_listeners().
router_parse_list_from_string() correctly reports the router number
  it's working on.
only call dirserv_add_own_fingerprint() and
   dirserv_add_descriptor() on startup if we're an authdirserver.
if AuthDir and !ORPort then fail.
if AuthDir and ClientOnly then fail.


svn:r2061
2004-07-20 10:17:43 +00:00
Nick Mathewson
54c129d8dc abstract ORPort/SocksPort checks into server_mode(), proxy_mode(), clique_mode(), etc. Dont change underlying comments.
svn:r2054
2004-07-18 21:47:04 +00:00
Nick Mathewson
e9365f9ed5 Bugfix: some things (like ctrl-z) can make a second take more than one second
svn:r2042
2004-07-13 18:07:57 +00:00
Roger Dingledine
d37850bb98 only count bytes transmitted to/from non-local IPs
svn:r2041
2004-07-13 16:58:01 +00:00
Roger Dingledine
86e0ede07e checkpoint: start working on bandwidth tracking and
letting clients evaluate whether they're suitable servers


svn:r2037
2004-07-13 07:42:20 +00:00
Roger Dingledine
3294b514d3 when you expire a wedged dir conn, conn_close_if_marked will take
care of trying to flush before it closes


svn:r2035
2004-07-13 00:38:08 +00:00
Roger Dingledine
cbf73b2bc5 touchups all over
put uptime in descriptor


svn:r2011
2004-07-04 22:48:11 +00:00
Roger Dingledine
f42f04c859 cleanups on 008pre1 items
svn:r1993
2004-06-30 21:48:02 +00:00
Nick Mathewson
b1e9adf056 Always use get_data_directory() instead of options.DataDirectory; fix a memory leak in router.c
svn:r1991
2004-06-30 16:37:08 +00:00
Nick Mathewson
76f769deb9 Remaining 008pre1 items done; deferred where more design is needed.
More docs and (way more!) testing needed.

Done:
 - Authdirservers down directories from others.
 - Generate and use running-routers lists
 - Cache directories; store across reboots.
 - Refactor directory parsing a bit; note potential trouble spots.


svn:r1985
2004-06-25 00:29:31 +00:00
Nick Mathewson
8aec3a7301 Implement several 008pre1 items: needs more testing
svn:r1981
2004-06-21 04:37:27 +00:00
Nick Mathewson
a788981399 Implement code to run tor as an NT service. More testing is needed, as is code to install the service.
svn:r1966
2004-06-12 21:43:02 +00:00
Nick Mathewson
125b351970 Break tor_main into startup/loop/shutdown portions, to make NT service refactoring possible.
svn:r1965
2004-06-12 19:45:46 +00:00
Nick Mathewson
184f4e6044 Rotate dnsworkers and cpuworkers on SIGHUP, so they get new config settings too
svn:r1950
2004-06-06 03:38:31 +00:00
Nick Mathewson
605e10a650 Stop multiplying logs on sighup.
svn:r1936
2004-06-02 19:18:37 +00:00
Nick Mathewson
0d20fee2fb Add more asserts to dns-pending connections; fix a couple seeming bugs.
svn:r1931
2004-06-01 22:09:58 +00:00
Roger Dingledine
4181d18b3d declare the epipe bug a non-bug.
now we catch and ignore epipe signals, and when write returns epipe,
we simply return -1 and close the socket/connection.


svn:r1928
2004-06-01 17:31:13 +00:00
Roger Dingledine
834ffa358f bugfix: if the wedged dir conn has no bytes to flush, then we never
close it.


svn:r1924
2004-05-28 17:56:17 +00:00
Roger Dingledine
8064807896 dirservers try to reconnect periodically too, in case connections have failed
svn:r1922
2004-05-28 15:01:47 +00:00
Nick Mathewson
9b4e8486ce Keep temporary log in place while configuring logs
svn:r1919
2004-05-24 02:28:15 +00:00
Nick Mathewson
ccb825128e Tinker with log behavior: never send error messages about logs into the bitbucket
svn:r1912
2004-05-20 19:47:28 +00:00
Roger Dingledine
66dd21b7a4 some more patching
svn:r1910
2004-05-20 08:41:54 +00:00
Roger Dingledine
30a07b2ecd non-dirservers expire routerinfo's that are more than a day old
svn:r1907
2004-05-20 05:10:30 +00:00
Nick Mathewson
9d2cd7fc6e Allow multiple logfiles at different severity ranges
svn:r1899
2004-05-19 20:07:08 +00:00
Roger Dingledine
d2de7120fa fix a seg fault, add another XXX for nick ;)
svn:r1892
2004-05-18 16:54:04 +00:00
Nick Mathewson
7511fbf993 Resolve some XXXs
svn:r1889
2004-05-18 15:35:21 +00:00
Nick Mathewson
50b7ebcf9e Make directory functions update routerlist, not replace it. Add notion of OR-is-trusted-to-be-a-dirserver. Arma, please review: does this handle being a dirserver right?
svn:r1880
2004-05-17 20:31:01 +00:00
Roger Dingledine
5ba9235873 clean up directory.c API
svn:r1860
2004-05-12 23:48:57 +00:00
Roger Dingledine
1cf1836990 break connection_edge_end out of connection_mark_for_close
svn:r1858
2004-05-12 21:12:33 +00:00
Roger Dingledine
32c42a0ee2 break rend_client_desc_fetched out of connection_mark_for_close
svn:r1856
2004-05-12 20:36:44 +00:00
Roger Dingledine
4c9138d640 calling flush_buf and not checking for return value is bad
svn:r1851
2004-05-12 18:41:32 +00:00
Nick Mathewson
3e2f889a29 Add an extra flush attempt when closing wedged dir conns, in an attempt to isolate the EPIPE bug
svn:r1848
2004-05-11 01:55:32 +00:00
Roger Dingledine
3cdf2d67da it's amazing what a bit of punctuation can do for appearances
svn:r1843
2004-05-10 10:27:54 +00:00
Nick Mathewson
81922a125c More doxygenation.
svn:r1832
2004-05-10 04:34:48 +00:00
Roger Dingledine
c6d4a00c5f more doxygen markup
plenty more remains


svn:r1824
2004-05-09 16:47:25 +00:00
Roger Dingledine
b384c5a18d bugfix: do directory_send_command only after we've established a socket
also many comments, cleaning, etc


svn:r1823
2004-05-09 16:33:04 +00:00
Roger Dingledine
9bf9ca4d09 bugfix: add a circ->resolving_streams field, and make dns resolving streams not actually in the connection_array until they're done resolving.
bugfix: actually complain if we duplicate mark-for-close a circuit

add more logging for relay ends that claim dns resolve failed, so we can
find out why they're not being retried.


svn:r1798
2004-05-06 11:08:04 +00:00
Nick Mathewson
e6477a8e16 Document the rest of main.c
svn:r1797
2004-05-05 21:35:12 +00:00
Nick Mathewson
682a805092 Comments for nearly all non-tricky files
svn:r1796
2004-05-05 21:32:43 +00:00
Nick Mathewson
2ba0776b02 Only connection_add connections once they have conn->s sett; refactor code around this. Should make stuff more bulletproof.
svn:r1788
2004-05-05 01:26:57 +00:00
Roger Dingledine
608c156820 must close marked connections at the end of run_scheduled_events.
otherwise they might have a socket -1, and if we leave them around
they'll muck up poll/select.

i think this was the cause of our win32 and os x fakepoll crashes,
and probably would cause other errors down the road.


svn:r1786
2004-05-05 00:59:42 +00:00
Nick Mathewson
af08c4f878 Working strerror for windows socket errors, plus some snide comments.
svn:r1775
2004-05-02 20:18:21 +00:00
Nick Mathewson
908ccb9dcd Handle windows socket errors correctly; comment most of common.
svn:r1756
2004-05-01 20:46:28 +00:00
Roger Dingledine
fff89216a9 tell us when we're rotating things
svn:r1712
2004-04-26 09:32:51 +00:00
Roger Dingledine
25d54257fb use tor_assert
remove obsolete BUF_OK macro


svn:r1697
2004-04-25 20:37:37 +00:00
Nick Mathewson
cb3897e5ab remove spurious router_rebuild_descriptor
svn:r1692
2004-04-25 19:01:49 +00:00
Roger Dingledine
0b31d0d4e8 more touch-ups
svn:r1687
2004-04-24 23:32:24 +00:00
Nick Mathewson
c44016e86e Merge flagday into main branch.
svn:r1683
2004-04-24 22:17:50 +00:00
Roger Dingledine
3c250a2fed only expire wedged dir conns that haven't already been expired
svn:r1676
2004-04-20 17:27:54 +00:00
Roger Dingledine
5cfec379ae expire wedged dir conns after 5min without write, not simply after 5min
svn:r1673
2004-04-19 20:08:42 +00:00
Roger Dingledine
d40e9f453f give wedged dir conns a last chance to flush
svn:r1671
2004-04-19 01:59:20 +00:00
Roger Dingledine
8d86f8abf5 reverse the logic, captain
svn:r1664
2004-04-18 06:42:13 +00:00
Roger Dingledine
7a7baf0552 expire dir connections that live for more than 5 minutes
svn:r1663
2004-04-18 06:35:31 +00:00
Roger Dingledine
01e594e512 clean up some warnings
svn:r1651
2004-04-17 06:34:20 +00:00
Nick Mathewson
baaf58fe1d only consider uploading descriptors every 5 sec
svn:r1612
2004-04-13 19:53:25 +00:00
Nick Mathewson
a2ece0fc08 Separate "start-establishing-introduction" from "upload descriptors"; only upload descriptors containing fully established intro points.
svn:r1607
2004-04-13 17:16:47 +00:00
Roger Dingledine
e0ce205a76 clean up circuit rebuilding some; fix some bugs we hadn't hit yet
svn:r1606
2004-04-13 05:20:52 +00:00
Roger Dingledine
f4ff5a75c1 break circuit_build_needed_circs into its own func
svn:r1596
2004-04-12 22:47:12 +00:00
Roger Dingledine
48e0228f1e expire old CIRCUIT_PURPOSE_C_REND_READY circs too
svn:r1585
2004-04-09 20:08:13 +00:00
Nick Mathewson
4e1b65f53d Dump introduction point status on kill -USR1
svn:r1584
2004-04-09 20:02:16 +00:00
Nick Mathewson
f9ade70cf9 Resolve init-services-in-do-hup issue
svn:r1583
2004-04-09 19:37:50 +00:00
Roger Dingledine
c80b42e17c don't call rend_services_init right before we fetch the
dir, because we call it right after now.


svn:r1582
2004-04-09 19:34:55 +00:00
Roger Dingledine
c5bef32d95 call directory_has_arrived has arrived every time we get
a new directory, not just the first time


svn:r1581
2004-04-09 19:30:38 +00:00
Nick Mathewson
c256f2c3a1 Make comment more sensible. Still uncertain about when to call rend_services_init, though.
svn:r1580
2004-04-09 17:54:20 +00:00
Nick Mathewson
facb5d4221 Reload rendezvous service keys on sighup; otherwise, we wind up with a
bunch of half-initialized services.  This should solve half of
weasel's current bug.  The crash is the other half.

(arma: should we also call rend_services_init on hup?)


svn:r1578
2004-04-09 17:48:09 +00:00
Roger Dingledine
4011906b6b get more serious about hunting The Bug
(it has been haunting us since the days of 0.0.2preX)


svn:r1576
2004-04-09 09:39:42 +00:00
Roger Dingledine
63cde97253 don't try to build intro circs until you've fetched the directory
svn:r1541
2004-04-07 22:48:06 +00:00
Nick Mathewson
4d14b786da Make sure we have our own keys before we initialize our routerlist
svn:r1535
2004-04-07 21:44:46 +00:00
Roger Dingledine
4df06ab5bb let bob replenish his intro points and republish service desc
as necessary


svn:r1528
2004-04-07 20:47:50 +00:00
Roger Dingledine
4a9587a486 we were uploading our server descriptor to each the dirservers
when we boot, and then also on the first iteration of the main loop


svn:r1520
2004-04-07 19:30:22 +00:00
Roger Dingledine
7793078dff alice can now look up bob's service descriptor,
choose an intro point, connect to it,
choose a rend point, connect to it and establish a cookie,
get an ack from the rendezvous point,
and know when both circs are ready for her.

APConns don't use conn->purpose anymore

don't initiate a renddesc lookup if one is already in progress

also fix a buffer overflow in nickname parsing (only exploitable
by the operator though)


svn:r1471
2004-04-05 00:47:48 +00:00
Roger Dingledine
4e996a4ce8 tabs
svn:r1456
2004-04-03 02:14:20 +00:00
Roger Dingledine
f34e6da3e7 now circuit_get_newest returns an appropriate circ for your purpose
connection_ap_handshake_attach_circuit attaches to a circ of the
right purpose

add a skeletal rendclient.c


svn:r1441
2004-04-02 22:23:15 +00:00
Roger Dingledine
64cb3a027f teach directory servers to handle renddesc responses
svn:r1434
2004-04-01 21:32:01 +00:00
Roger Dingledine
cc3c4245cb let the circuit-launcher choose the exit node (if he wants)
svn:r1428
2004-04-01 03:44:49 +00:00
Roger Dingledine
d01497cf3c outline what bob does to initialize his hidden services
let circuit_launch_new return the circ it just made


svn:r1424
2004-04-01 03:23:28 +00:00
Roger Dingledine
d13857a3f0 put in hooks for alice and bob logic when circuits finish/fail
let you specify the purpose of circuits you launch

bugfix: we used to be declaring the first successful circuit too                               early -- when the first hop finished. now we're more accurate.


svn:r1421
2004-04-01 01:57:22 +00:00
Roger Dingledine
ee45ae575d allow conns to demand to be attached to a clean circuit
(nobody uses this yet)


svn:r1417
2004-03-31 23:06:16 +00:00
Roger Dingledine
a0b0d16981 Add an ap_bridge function to do a socketpair and skip socks.
This allows us to do a directory connection *through* tor just
as if we're doing it as an application.

Make ap_conns tolerate it when the application sends stuff before
The socks handshake is done (it just buffers it).

Tell directory_initiate_command the length of the payload (because
it might include nuls).

Add a directory_has_arrived function to, for example, start building
the rendezvous service descriptor.


svn:r1412
2004-03-31 22:02:13 +00:00
Nick Mathewson
bf83b1e345 Add code to configure hidden services, parse configuration, generate keys and service IDs, and store/load them from disk
svn:r1410
2004-03-31 21:35:23 +00:00
Nick Mathewson
8fedefe6cb rename hidserv_xx
svn:r1406
2004-03-31 04:10:10 +00:00
Nick Mathewson
b32440a028 Implement hidserv_XX functions; there is still an XXX in directory_handle_command
svn:r1404
2004-03-31 03:42:56 +00:00
Roger Dingledine
2d3ac08633 Refactor directory servers
* read all the time (before we would ignore eof sometimes, oops)
* we can handle different urls now
* send back 404 for an un-handled url
* commands initiated by the client can handle payloads now
* introduce conn->purpose to avoid exponential state-space explosion


svn:r1400
2004-03-30 22:57:49 +00:00
Roger Dingledine
524312494b use 'notice' loglevel for things the operator should hear
but that aren't warnings


svn:r1384
2004-03-30 03:15:53 +00:00
Nick Mathewson
0e6084d751 Remove descriptors that are older than 24 hours from the directory. Use strlcat instead of strncat to generate directories.
svn:r1361
2004-03-29 19:28:16 +00:00
Roger Dingledine
2ba9901cb4 oh, i forgot to enable the find-munged-conn function
svn:r1357
2004-03-28 21:14:05 +00:00
Roger Dingledine
47b40de0aa only build circuits after we've fetched the directory
this resolves a subtle bug where tor clients were preferentially using
the directory servers, since when they start building circuits they
know only about the directory servers

on the other hand, it now takes longer after startup before there's
a working circuit. so it goes.


svn:r1350
2004-03-27 00:15:09 +00:00
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