Commit Graph

390 Commits

Author SHA1 Message Date
Roger Dingledine
deac704399 connection_new() can't ever fail
svn:r497
2003-09-27 07:28:44 +00:00
Roger Dingledine
9e5cafc395 first pass: obey log convention
ERR is if something fatal just happened

WARNING is something bad happened, but we're still running. The bad thing
is either a bug in the code, an attack or buggy protocol/implementation
of the remote peer, etc. The operator should examine the bad thing and
try to correct it.
(No error or warning messages should be expected. I expect most people
to run on -l warning eventually.)

NOTICE is never ever used.

INFO means something happened (maybe bad, maybe ok), but there's nothing
you need to (or can) do about it.

DEBUG is for everything louder than INFO.


svn:r486
2003-09-26 10:03:50 +00:00
Roger Dingledine
3b5191d36d various bugfixes and updates
redo all the config files for the new format (we'll redo them again soon)

fix (another! yuck) segfault in log_fn when input is too large
tor_tls_context_new() returns -1 for error, not NULL
fix segfault in check_conn_marked() on conn's that die during tls handshake

make ORs also initialize conn from router when we're the receiving node

make non-dirserver ORs upload descriptor to every dirserver on startup
add our local address to the descriptor
add Content-Length field to POST command
revert the Content-Length search in fetch_from_buf_http() to previous code
fix segfault in memmove in fetch_from_buf_http()
raise maximum allowed headers/body size in directory.c


svn:r484
2003-09-25 10:42:07 +00:00
Nick Mathewson
3d4ccb781a Refactor buffers; implement descriptors.
'buf_t' is now an opaque type defined in buffers.c .

Router descriptors now include all keys; routers generate keys as
needed on startup (in a newly defined "data directory"), and generate
their own descriptors.  Descriptors are now self-signed.

Implementation is not complete: descriptors are never published; and
upon receiving a descriptor, the directory doesn't do anything with
it.

At least "routers.or" and orkeygen are now obsolete, BTW.


svn:r483
2003-09-25 05:17:11 +00:00
Roger Dingledine
40d0fca63a cleanups, bugfixes, more verbose logs
Fixed up the assert_*_ok funcs some (more work remains)

Changed config so it reads either /etc/torrc or the -f arg, never both

Finally tracked down a nasty bug with our use of tls:
  It turns out that if you ask SSL_read() for no more than n bytes, it
  will read the entire record from the network (and maybe part of the next
  record, I'm not sure), give you n bytes of it, and keep the remaining
  bytes internally. This is fine, except our poll-for-read looks at the
  network, and there are no bytes pending on the network, so we never know
  to ask SSL_read() for more bytes. Currently I've hacked it so if we ask
  for n bytes and it returns n bytes, then it reads again right then. This
  will interact poorly with our rate limiting; we need a cleaner solution.


svn:r481
2003-09-24 21:24:52 +00:00
Roger Dingledine
9fe1ed26ff get network/host order working right again for socks4
svn:r476
2003-09-21 06:44:53 +00:00
Roger Dingledine
ed51df7453 bugfixes and note missing features
deal with content-length headers better when reading http
don't assume struct socks4_info is a packed struct
fail the socks handshake if destip is zero
flesh out conn_state_to_string() for dir conn
fix typo (bug) in connection_handle_read()
directory get is now called fetch, post is now upload
reopen logs on sighup


svn:r475
2003-09-21 06:15:43 +00:00
Roger Dingledine
078c5ab617 leave the socks handshake on the inbuf until it's complete
this paves the way for supporting socks5 and other handshakes
it also removes those pesky AP-only variables from connection_t

also hacked a fix for a bug where some streams weren't ending properly --
maybe because marked connections weren't flushing properly?


svn:r472
2003-09-18 08:11:31 +00:00
Roger Dingledine
b97945e411 add in directory 'post' support
svn:r471
2003-09-17 20:09:06 +00:00
Roger Dingledine
c0f5ddcf33 fix confirmed win32 bug
svn:r435
2003-09-08 23:10:24 +00:00
Roger Dingledine
3fa170e11f more futzing towards tls
not there yet


svn:r429
2003-09-07 10:24:40 +00:00
Roger Dingledine
99035f3520 clean read_to_buf more
svn:r428
2003-09-05 11:25:24 +00:00
Nick Mathewson
fd20011c26 Add initial interfaces and code for TLS support. Interfaces are right; code needs work and testing.
svn:r424
2003-09-04 16:05:08 +00:00
Nick Mathewson
cd3467bb01 Attempt to make sockets code work right on windows.
svn:r398
2003-08-14 17:13:52 +00:00
Roger Dingledine
c6f70e36e0 implemented total read rate limiting
svn:r365
2003-07-05 07:10:34 +00:00
Roger Dingledine
dbf3435cde simplify fetch_from_buf; cull idle dnsworkers.
svn:r354
2003-06-25 00:31:41 +00:00
Nick Mathewson
95e5384af3 Change many files to new log_fn format
svn:r333
2003-06-17 22:18:26 +00:00
Roger Dingledine
cbe7be1f78 remove on-the-fly compression feature
it wasn't working, and it was harder than we'd anticipated

not worth it.


svn:r316
2003-06-13 10:23:42 +00:00
Roger Dingledine
39e9d79038 add circuit-level sendme relay cells
remove sendme cells
replace malloc with tor_malloc
patch (but not track down) bug in onion pending list
streamline connection_ap handshake


svn:r293
2003-05-20 06:41:23 +00:00
Roger Dingledine
0560008497 terminology shift: data->relay, topic->relay, topic->stream
svn:r258
2003-05-01 06:42:29 +00:00
Nick Mathewson
acc33c18e2 Tests for crypto; more tests for buffers
svn:r234
2003-04-16 15:24:09 +00:00
Nick Mathewson
1fa0fc1487 Introduce a few unit tests (from older code), refactor compression setup/teardown
svn:r232
2003-04-15 19:10:18 +00:00
Nick Mathewson
c217b1ca71 Add magic to end of C files to make emacs happy; split test invocation into separate file.
svn:r224
2003-04-07 02:12:02 +00:00
Roger Dingledine
b8da74d30a get rid of those nasty tabs
svn:r216
2003-03-24 03:00:20 +00:00
Nick Mathewson
9d03ae627d Fix message when decompressing
svn:r214
2003-03-19 22:51:38 +00:00
Nick Mathewson
29da03cbdc Be loud when decompressing
svn:r213
2003-03-19 22:47:34 +00:00
Nick Mathewson
9c263b322b Make decompression loud.
svn:r209
2003-03-19 22:28:52 +00:00
Nick Mathewson
6deed60bb5 Add code for end-to-end zlib compression. Still needs flow-control
svn:r187
2003-03-17 02:42:45 +00:00
Roger Dingledine
fb2f4a0418 pack into data cells more intelligently
svn:r173
2003-03-10 22:40:02 +00:00
Roger Dingledine
1768f29d7e better comments and a few patches
svn:r164
2003-03-04 04:36:37 +00:00
Roger Dingledine
c35373a2cf major overhaul: dns slave subsystem, topics
on startup, it forks off a master dns handler, which forks off dns
slaves (like the apache model). slaves as spawned as load increases,
and then reused. excess slaves are not ever killed, currently.

implemented topics. each topic has a receive window in each direction
at each edge of the circuit, and sends sendme's at the data level, as
per before. each circuit also has receive windows in each direction at
each hop; an edge sends a circuit-level sendme as soon as enough data
cells have arrived (regardless of whether the data cells were flushed
to the exit conns). removed the 'connected' cell type, since it's now
a topic command within data cells.

at the edge of the circuit, there can be multiple connections associated
with a single circuit. you find them via the linked list conn->next_topic.

currently each new ap connection starts its own circuit, so we ought
to see comparable performance to what we had before. but that's only
because i haven't written the code to reattach to old circuits. please
try to break it as-is, and then i'll make it reuse the same circuit and
we'll try to break that.


svn:r152
2003-01-26 09:02:24 +00:00
Roger Dingledine
827c7444f8 more robust http(ish) handling
svn:r123
2002-09-28 05:53:00 +00:00
Roger Dingledine
3a7f3ba348 cleanup: don't use size_t when you mean int
size_t is what you get back from sizeof(). no more, no less.


svn:r80
2002-08-24 04:59:21 +00:00
Roger Dingledine
d8c0d21b49 linkpadding is now off by default.
svn:r79
2002-08-23 06:49:43 +00:00
Roger Dingledine
267434bdea Implemented congestion control
Servers are allowed to send 100 cells initially, and can't send more until
they receive a 'sendme' cell from that direction, indicating that they
can send 10 more cells. As it currently stands, the exit node quickly
runs out of window, and sends bursts of 10 whenever a sendme cell gets
to him. This is much much much faster (and more flexible) than the old
"give each circuit 1 kB/s and hope nothing overflows" approach.

Also divided out the connection_watch_events into stop_reading,
start_writing, etc. That way we can control them separately.


svn:r54
2002-07-18 06:37:58 +00:00
Roger Dingledine
c951c6f186 new config files, some bugfixes
svn:r51
2002-07-16 02:12:58 +00:00
Roger Dingledine
117cbeeaaf Implemented link padding and receiver token buckets
Each socket reads at most 'bandwidth' bytes per second sustained, but
can handle bursts of up to 10*bandwidth bytes.

Cells are now sent out at evenly-spaced intervals, with padding sent
out otherwise. Set Linkpadding=0 in the rc file to send cells as soon
as they're available (and to never send padding cells).

Added license/copyrights statements at the top of most files.

router->min and router->max have been merged into a single 'bandwidth'
value. We should make the routerinfo_t reflect this (want to do that,
Mat?)

As the bandwidth increases, and we want to stop sleeping more and more
frequently to send a single cell, cpu usage goes up. At 128kB/s we're
pretty much calling poll with a timeout of 1ms or even 0ms. The current
code takes a timeout of 0-9ms and makes it 10ms. prepare_for_poll()
handles everything that should have happened in the past, so as long as
our buffers don't get too full in that 10ms, we're ok.

Speaking of too full, if you run three servers at 100kB/s with -l debug,
it spends too much time printing debugging messages to be able to keep
up with the cells. The outbuf ultimately fills up and it kills that
connection. If you run with -l err, it works fine up through 500kB/s and
probably beyond. Down the road we'll want to teach it to recognize when
an outbuf is getting full, and back off.


svn:r50
2002-07-16 01:12:15 +00:00
Roger Dingledine
c603e403df fixed a critical bug in yesterday's changes to buffers.c
(starting to debug my OP integration)


svn:r18
2002-07-02 06:02:15 +00:00
Roger Dingledine
b503d4c6d6 made 'app' connection be 'exit' connection
general cleanup, particularly in buffers.c


svn:r17
2002-06-30 07:37:49 +00:00
Roger Dingledine
9a928eeb12 Initial revision
svn:r2
2002-06-26 22:45:49 +00:00