diff options
author | David Goulet <dgoulet@torproject.org> | 2019-02-20 11:29:55 -0500 |
---|---|---|
committer | David Goulet <dgoulet@torproject.org> | 2019-02-20 11:29:55 -0500 |
commit | a30f17f72fb4e016f1c0d7f8619fcb20fec29d16 (patch) | |
tree | 7f379a1e24c605e81ce15948ac623c17691dddb3 /src/core | |
parent | c22446e3055603cdbbea36e31ea49436d9ca3e11 (diff) | |
parent | 8d04dc416bd6aa3fefc0914add8708083dc99d52 (diff) | |
download | tor-a30f17f72fb4e016f1c0d7f8619fcb20fec29d16.tar.gz tor-a30f17f72fb4e016f1c0d7f8619fcb20fec29d16.zip |
Merge branch 'tor-github/pr/696'
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/mainloop/connection.c | 17 | ||||
-rw-r--r-- | src/core/mainloop/connection.h | 2 |
2 files changed, 19 insertions, 0 deletions
diff --git a/src/core/mainloop/connection.c b/src/core/mainloop/connection.c index 37f35c8b8d..b53552a53d 100644 --- a/src/core/mainloop/connection.c +++ b/src/core/mainloop/connection.c @@ -4341,6 +4341,23 @@ connection_write_to_buf_impl_,(const char *string, size_t len, connection_write_to_buf_commit(conn, written); } +/** + * Write a <b>string</b> (of size <b>len</b> to directory connection + * <b>dir_conn</b>. Apply compression if connection is configured to use + * it and finalize it if <b>done</b> is true. + */ +void +connection_dir_buf_add(const char *string, size_t len, + dir_connection_t *dir_conn, int done) +{ + if (dir_conn->compress_state != NULL) { + connection_buf_add_compress(string, len, dir_conn, done); + return; + } + + connection_buf_add(string, len, TO_CONN(dir_conn)); +} + void connection_buf_add_compress(const char *string, size_t len, dir_connection_t *conn, int done) diff --git a/src/core/mainloop/connection.h b/src/core/mainloop/connection.h index f4f0e839ae..de6473251d 100644 --- a/src/core/mainloop/connection.h +++ b/src/core/mainloop/connection.h @@ -226,6 +226,8 @@ MOCK_DECL(void, connection_write_to_buf_impl_, /* DOCDOC connection_write_to_buf */ static void connection_buf_add(const char *string, size_t len, connection_t *conn); +void connection_dir_buf_add(const char *string, size_t len, + dir_connection_t *dir_conn, int done); static inline void connection_buf_add(const char *string, size_t len, connection_t *conn) { |