[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] [tor/master 31/38] Some bufferevents related fixes and pointers for nickm
Author: Sebastian Hahn <sebastian@xxxxxxxxxxxxxx>
Date: Sun, 4 Apr 2010 03:34:42 +0200
Subject: Some bufferevents related fixes and pointers for nickm
Commit: 865bea3b895831a486b024e90f58d72d025ce284
---
src/common/compat_libevent.c | 4 +++-
src/common/tortls.c | 2 +-
src/or/buffers.c | 5 +++--
src/or/connection.c | 3 ++-
4 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/src/common/compat_libevent.c b/src/common/compat_libevent.c
index 2ae280e..ee8b5b5 100644
--- a/src/common/compat_libevent.c
+++ b/src/common/compat_libevent.c
@@ -554,7 +554,9 @@ periodic_timer_free(periodic_timer_t *timer)
#ifdef USE_BUFFEREVENTS
static const struct timeval *one_tick = NULL;
/**
- DOCDOC
+ * Return a special timeout to be passed whenever libevent's O(1) timeout
+ * implementation should be used. Only use this when the timer is supposed
+ * to fire after 1 / TOR_LIBEVENT_TICKS_PER_SECOND seconds have passed.
*/
const struct timeval *tor_libevent_get_one_tick_timeout(void)
{
diff --git a/src/common/tortls.c b/src/common/tortls.c
index 3ae3ef8..fb2e9ed 100644
--- a/src/common/tortls.c
+++ b/src/common/tortls.c
@@ -1206,7 +1206,7 @@ tor_tls_handshake(tor_tls_t *tls)
}
/** Perform the final part of the intial TLS handshake on <b>tls</b>. This
- * should be called for the first handshake only: it determiens whether the v1
+ * should be called for the first handshake only: it determines whether the v1
* or the v2 handshake was used, and adjusts things for the renegotiation
* handshake as appropriate.
*
diff --git a/src/or/buffers.c b/src/or/buffers.c
index eaa7427..a256f29 100644
--- a/src/or/buffers.c
+++ b/src/or/buffers.c
@@ -1017,7 +1017,7 @@ fetch_var_cell_from_buf(buf_t *buf, var_cell_t **out, int linkproto)
#ifdef USE_BUFFEREVENTS
/** Try to read <b>n</b> bytes from <b>buf</b> at <b>pos</b> (which may be
- * NULL for the start fo the buffer), copying the data only if necessary. Set
+ * NULL for the start of the buffer), copying the data only if necessary. Set
* *<b>data</b> to a pointer to the desired bytes. Set <b>free_out</b> to 1
* if we needed to malloc *<b>data</b> because the original bytes were
* noncontiguous; 0 otherwise. Return the number of bytes actually available
@@ -1359,6 +1359,7 @@ fetch_from_buf_http(buf_t *buf,
}
#ifdef USE_BUFFEREVENTS
+/** As fetch_from_buf_http, buf works on an evbuffer. */
int
fetch_from_evbuffer_http(struct evbuffer *buf,
char **headers_out, size_t max_headerlen,
@@ -1564,7 +1565,7 @@ fetch_from_evbuffer_socks(struct evbuffer *buf, socks_request_t *req,
* at a buffer's contents, we look at the <b>datalen</b> bytes of data in
* <b>data</b>. Instead of removing data from the buffer, we set
* <b>drain_out</b> to the amount of data that should be removed (or -1 if the
- * buffer should be cleared. Instead of pulling more data into the first
+ * buffer should be cleared). Instead of pulling more data into the first
* chunk of the buffer, we set *<b>want_length_out</b> to the number of bytes
* we'd like to see in the input buffer. */
static int
diff --git a/src/or/connection.c b/src/or/connection.c
index b6f0d5d..c9a7308 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -2908,7 +2908,8 @@ int
connection_fetch_from_buf(char *string, size_t len, connection_t *conn)
{
IF_HAS_BUFFEREVENT(conn, {
- return bufferevent_read(conn->bufev, string, len);
+ /* XXX overflow -seb */
+ return (int)bufferevent_read(conn->bufev, string, len);
}) ELSE_IF_NO_BUFFEREVENT {
return fetch_from_buf(string, len, conn->inbuf);
}
--
1.7.1