aboutsummaryrefslogtreecommitdiff
path: root/src/or/buffers.c
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2005-06-11 06:07:22 +0000
committerRoger Dingledine <arma@torproject.org>2005-06-11 06:07:22 +0000
commit2587fa09f9d0304a4ba575d1d3aeae665d1cb0a6 (patch)
treec5a0371ad7ef0bf02eaf37eeb44f5a190e8f9e0b /src/or/buffers.c
parent986166be99f3341f4eedd89231e356ef116777dd (diff)
downloadtor-2587fa09f9d0304a4ba575d1d3aeae665d1cb0a6.tar.gz
tor-2587fa09f9d0304a4ba575d1d3aeae665d1cb0a6.zip
move more docs into our code
svn:r4406
Diffstat (limited to 'src/or/buffers.c')
-rw-r--r--src/or/buffers.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/or/buffers.c b/src/or/buffers.c
index 7fdbcc81b7..41de4e87fd 100644
--- a/src/or/buffers.c
+++ b/src/or/buffers.c
@@ -477,6 +477,23 @@ read_to_buf_tls_impl(tor_tls *tls, size_t at_most, buf_t *buf, char *next)
}
/** As read_to_buf, but reads from a TLS connection.
+ *
+ * Using TLS on OR connections complicates matters in two ways.
+ *
+ * First, a TLS stream has its own read buffer independent of the
+ * connection's read buffer. (TLS needs to read an entire frame from
+ * the network before it can decrypt any data. Thus, trying to read 1
+ * byte from TLS can require that several KB be read from the network
+ * and decrypted. The extra data is stored in TLS's decrypt buffer.)
+ * Because the data hasn't been read by Tor (it's still inside the TLS),
+ * this means that sometimes a connection "has stuff to read" even when
+ * poll() didn't return POLLIN. The tor_tls_get_pending_bytes function is
+ * used in connection.c to detect TLS objects with non-empty internal
+ * buffers and read from them again.
+ *
+ * Second, the TLS stream's events do not correspond directly to network
+ * events: sometimes, before a TLS stream can read, the network must be
+ * ready to write -- or vice versa.
*/
int read_to_buf_tls(tor_tls *tls, size_t at_most, buf_t *buf) {
int r;