Skip to content
Snippets Groups Projects
Commit bc50f082 authored by David Goulet's avatar David Goulet :panda_face:
Browse files

Merge branch 'tor-github/pr/1944'

parents 2eae59e4 3adabaf3
Branches
Tags
No related merge requests found
o Major bugfix (TLS, buffer):
- When attempting to read N bytes on a TLS connection, really try to read
those N bytes. Before that, Tor would stop reading after the first TLS
record which can be smaller than N bytes even though more data was waiting
on the TLS connection socket. The remaining data would have been read at
the next mainloop event. Fixes bug 40006; bugfix on 0.1.0.5-rc.
......@@ -59,6 +59,9 @@ read_to_chunk_tls(buf_t *buf, chunk_t *chunk, tor_tls_t *tls,
* 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.
*
* On success, return the number of bytes read. On error, a TOR_TLS_* negative
* code is returned (expect any of them except TOR_TLS_DONE).
*/
int
buf_read_from_tls(buf_t *buf, tor_tls_t *tls, size_t at_most)
......@@ -92,8 +95,6 @@ buf_read_from_tls(buf_t *buf, tor_tls_t *tls, size_t at_most)
return r; /* Error */
tor_assert(total_read+r <= BUF_MAX_LEN);
total_read += r;
if ((size_t)r < readlen) /* eof, block, or no more to read. */
break;
}
return (int)total_read;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment