Commit Graph

174 Commits

Author SHA1 Message Date
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
d8e5f3a3a2 close immediately when write() fails too, else things will turn bad
svn:r1212
2004-03-03 07:26:34 +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
Nick Mathewson
6379dbbe2a warn more when losing data on closed/marked connections.
svn:r1203
2004-03-03 02:07:57 +00:00
Roger Dingledine
49281424ae bugfix: close_immediate called buf_clear but listeners don't have bufs
svn:r1202
2004-03-03 01:58:45 +00:00
Nick Mathewson
a1e4c6dc85 Fix assertion failure spotted by arma.
Apparently, when a DNS failure was already cached, then when we tried
to mark the exit connection as closed, we'd try to remove it from the
pending queue anyway, and hit an assert.  Now, we put failed-resolve
connections in a separate state so that mark_for_close does the right
thing.


svn:r1196
2004-03-02 07:24:11 +00:00
Roger Dingledine
195ee8c845 create a separate connection_edge_destroy() function
svn:r1176
2004-02-29 00:11:37 +00:00
Roger Dingledine
ae67c48805 bugfix: in some cases, connection_mark_for_close wasn't marking the conn
svn:r1174
2004-02-28 23:52:56 +00:00
Nick Mathewson
0a673f4491 Split dns_cancel_pending_resolve into dns_cancel_pending_resolve (kill a
resolve in response to a DNS worker dying) and connection_dns_remove (remove
a pending connection from the resolve structure.)


svn:r1168
2004-02-28 22:23:44 +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
cec2eee533 enable assert_connection_ok()
we weren't actually asserting much. oops.


svn:r1160
2004-02-28 07:51:30 +00:00
Roger Dingledine
70c43e152a note bug in assert_connection_ok
svn:r1159
2004-02-28 07:48:28 +00:00
Roger Dingledine
dd632e697e clean up some log messages and severities
still plenty more left to clean


svn:r1158
2004-02-28 07:01:22 +00:00
Roger Dingledine
e59f19ca03 some more small fixes
svn:r1152
2004-02-28 04:44:48 +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
Nick Mathewson
88e222ff76 Make has_sent_end irrelevant: only try to send end if reason is nonzero
svn:r1148
2004-02-28 03:06:31 +00:00
Roger Dingledine
d0ad9b147a and another one
svn:r1147
2004-02-27 23:30:27 +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
Nick Mathewson
496e414e52 Basic RAM poisoning and magic-checking to notice connection and circuit
corruption faster; also, check for corruption in dns.c so we can fail fast
for the bug that's nailing Lucky and moria3.


svn:r1123
2004-02-25 07:31:46 +00:00
Roger Dingledine
1b25794a56 bugfix: if the exit stream is pending on the resolve, and a destroy
arrives, then the stream wasn't getting removed from the pending list.

this may have been the lucky-bug.
this commit may also not actually fix the bug. it's darn hard to
reproduce.


svn:r1122
2004-02-25 06:57:57 +00:00
Roger Dingledine
7985f525ec fix some bugs in assert_connection_ok
svn:r1118
2004-02-24 22:33:30 +00:00
Roger Dingledine
f00dc6fe1e last minute fix: don't early-flush non-tls streams
e.g., this breaks directory service


svn:r1033
2004-01-31 00:36:00 +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
f5ebf4c712 push out a tls record's worth of data once you've got it
svn:r1009
2004-01-20 02:14:51 +00:00
Roger Dingledine
c485725c5a Fix the dns bug: children weren't dying
We were telling a child to die by closing the parent's file descriptor
to him. But newer children were inheriting the open file descriptor from
the parent, and since they weren't closing them, the socket never closed,
so the child never read eof, so he never knew to exit.

As a side effect to this bug, we were probably failing to properly close
connections to remote hosts, ORs, and OPs, after a dns child was born.

I'm surprised Tor worked at all.


svn:r974
2004-01-06 07:53:40 +00:00
Roger Dingledine
f3fdbadfdf randomize the initial circ_id and stream_id, so an adversary who
breaks in part-way through can't learn how many circs/streams have
been made


svn:r960
2003-12-28 04:46:09 +00:00
Roger Dingledine
a5e6ec244f rename circ_id_t to uint16_t for code clarity
change message when using non-recommended tor version


svn:r954
2003-12-19 19:55:02 +00:00
Roger Dingledine
45a66c6955 make a relay_header_t struct and pack/unpack funcs
split 7-byte stream_id string into 2-byte recognized and 2-byte stream_id
fix two seg faults in fetch_from_buf_http
fix several lurking seg faults in handling unexpected relay cells

still need to
 * clean up relay_crypt
 * use relay dummies if there's going to be a conflict with rh.recognized
 * check for a conflict when generating stream_ids


svn:r953
2003-12-19 05:09:51 +00:00
Roger Dingledine
6a19e64066 remove trailing whitespace
svn:r951
2003-12-17 21:09:31 +00:00
Roger Dingledine
21cc01299b infrastructure for integrity-checks in relay cells
make circuit_consider_sending_sendme use connection_edge_send_command
fix endian bug in relay length handling (maybe)


svn:r946
2003-12-16 22:56:50 +00:00
Roger Dingledine
08534a6271 start tracking the 'It appears I've already sent the end' warning
svn:r932
2003-12-14 08:32:14 +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
48e42e9346 back out the broken change from yesterday
svn:r891
2003-12-09 01:04:11 +00:00
Roger Dingledine
8bd7c94bf6 general cleanups
svn:r889
2003-12-07 22:03:47 +00:00
Roger Dingledine
d172fdd300 fix vicious bug in connection_ap_attach_pending that caused it to
never work.
fix vicious bug in choose_good_exit_server that caused it to *skip over*
  pending circuits, and look only at *non-pending circuits*, when choosing
  a good exit node for the new circuit.
bugfix: remove incorrect asserts in circuit_get_newest()


svn:r876
2003-12-03 09:50:02 +00:00
Roger Dingledine
02ec2cdb34 bugfix: we were writing to stderr even when it's closed
svn:r868
2003-11-30 09:51:35 +00:00
Roger Dingledine
3818776f62 remove a conn_close_if_marked warning
Nov 27 15:45:19.003 [warn] connection_write_to_buf(): write_to_buf failed. Closing connection (fd 42).
Nov 27 15:45:19.010 [warn] conn_close_if_marked(): Conn (socket 42) still wants to flush. Losing 0 bytes!


svn:r866
2003-11-30 09:35:26 +00:00
Roger Dingledine
00de055f43 bugfix: an offline OP would leak all its sockets and stop working
svn:r865
2003-11-29 02:50:12 +00:00
Nick Mathewson
1155ae9b03 Bring assert_connection_ok up to date
svn:r863
2003-11-23 18:14:19 +00:00
Roger Dingledine
c00953d2a1 make more sure we can't end up with two connections to the same OR
fix leaked pk in connection_tls_finish_handshake


svn:r839
2003-11-18 10:17:52 +00:00
Roger Dingledine
ac56486bf6 use the tor_malloc_zero wrapper
svn:r837
2003-11-18 08:20:19 +00:00
Nick Mathewson
7bde42676b Rename aci to circ_id throughout.
svn:r784
2003-11-11 03:01:48 +00:00
Nick Mathewson
dafb0e6a6e Make AP connections wait for a circuit if none exists.
Also:
  - Refactor socks request into a separate struct
  - Add a separate 'waiting for circuit' state to AP connections
    between 'waiting for socks' and 'open'.

Arma: can you check out the XXX's I've added to connection_edge? I may
be mishandling some async and close logic.


svn:r783
2003-11-11 02:41:31 +00:00
Roger Dingledine
1969c8a92f client now survives going offline better
fix badness in usage()
if neither socksport nor orrport is defined, quit
obsolete connection_flush_buf()


svn:r780
2003-11-10 08:06:55 +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
Roger Dingledine
c6b442a346 make end relay cells have payloads
move default exit policy into config files


svn:r653
2003-10-22 07:55:44 +00:00