summaryrefslogtreecommitdiff
path: root/lib/tcp.c
diff options
context:
space:
mode:
authorLinus Nordberg <linus@nordu.net>2011-03-08 13:37:46 +0100
committerLinus Nordberg <linus@nordu.net>2011-03-08 14:23:37 +0100
commitd464ebb9235fe78e6588e95d4d3333d5ee95ca48 (patch)
treec1a35006abc218813b4425edea4c79bbd3763766 /lib/tcp.c
parent657eec7ee5a276521eb456bf648878935e794b6e (diff)
Timeout implemented in request objects, supported by TCP.
TODO: UDP.
Diffstat (limited to 'lib/tcp.c')
-rw-r--r--lib/tcp.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/lib/tcp.c b/lib/tcp.c
index 1801d62..c315143 100644
--- a/lib/tcp.c
+++ b/lib/tcp.c
@@ -37,7 +37,7 @@ _conn_timeout_cb (int fd, short event, void *data)
rs_debug (("%s: connection timeout on %p (fd %d) connecting to %p\n",
__func__, conn, conn->fd, conn->active_peer));
conn->is_connecting = 0;
- rs_err_conn_push_fl (conn, RSE_TIMEOUT_IO, __FILE__, __LINE__, NULL);
+ rs_err_conn_push_fl (conn, RSE_TIMEOUT_CONN, __FILE__, __LINE__, NULL);
event_loopbreak (conn);
}
}
@@ -256,16 +256,11 @@ tcp_write_cb (struct bufferevent *bev, void *ctx)
int
tcp_set_connect_timeout (struct rs_connection *conn)
{
- struct timeval tv;
-
if (!conn->tev)
conn->tev = evtimer_new (conn->evb, _conn_timeout_cb, conn);
if (!conn->tev)
return rs_err_conn_push_fl (conn, RSE_EVENT, __FILE__, __LINE__,
"evtimer_new");
- tv.tv_sec = conn->realm->timeout;
- tv.tv_usec = 0;
- evtimer_add (conn->tev, &tv);
-
+ evtimer_add (conn->tev, &conn->timeout);
return RSE_OK;
}