diff options
author | Nick Mathewson <nickm@torproject.org> | 2009-07-31 11:11:45 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2010-09-27 12:28:43 -0400 |
commit | 57e7b54b7b4102de0c5776a1268367c18090033b (patch) | |
tree | cde7c95a1cb1bd3acfe4ff5577cafeba59d7e412 /src/or/or.h | |
parent | 94aac84a71bc695fe594e49a4fd0947fdbbd4895 (diff) | |
download | tor-57e7b54b7b4102de0c5776a1268367c18090033b.tar tor-57e7b54b7b4102de0c5776a1268367c18090033b.tar.gz |
Teach read_event/write_event manipulators about bufferevents.
Add an --enable-bufferevents config switch.
Diffstat (limited to 'src/or/or.h')
-rw-r--r-- | src/or/or.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/or/or.h b/src/or/or.h index 6332de83a..a699685c4 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -959,6 +959,7 @@ typedef struct connection_t { /** Our socket; -1 if this connection is closed, or has no socket. */ evutil_socket_t s; int conn_array_index; /**< Index into the global connection array. */ + struct event *read_event; /**< Libevent event structure. */ struct event *write_event; /**< Libevent event structure. */ buf_t *inbuf; /**< Buffer holding data read over this connection. */ @@ -969,6 +970,11 @@ typedef struct connection_t { * read? */ time_t timestamp_lastwritten; /**< When was the last time libevent said we * could write? */ + +#ifdef USE_BUFFEREVENTS + struct bufferevent *bufev; /**< A Libevent buffered IO structure. */ +#endif + time_t timestamp_created; /**< When was this connection_t created? */ /* XXXX_IP6 make this IPv6-capable */ @@ -1264,6 +1270,19 @@ static INLINE control_connection_t *TO_CONTROL_CONN(connection_t *c) return DOWNCAST(control_connection_t, c); } +#ifdef USE_BUFFEREVENTS +#define HAS_BUFFEREVENT(c) (((c)->bufev) != NULL) +#define IF_HAS_BUFFEREVENT(c, stmt) \ + do { \ + if ((conn)->bufev) do { \ + stmt ; \ + } while(0); \ + } while (0) +#else +#define HAS_BUFFEREVENT(c) (0) +#define IF_HAS_BUFFEREVENT(c, stmt) (void)0 +#endif + /** What action type does an address policy indicate: accept or reject? */ typedef enum { ADDR_POLICY_ACCEPT=1, |