summaryrefslogtreecommitdiff
path: root/lib/event.c
diff options
context:
space:
mode:
authorLinus Nordberg <linus@nordu.net>2011-03-06 17:08:41 +0100
committerLinus Nordberg <linus@nordu.net>2011-03-06 17:08:41 +0100
commitf082f0d0617d12854a5fd0dc683d357144e36c5c (patch)
tree71f49620ab48fbba4b82a0a153f2597e3ff0de2b /lib/event.c
parent43d0740f143ba737a1fc5ace3a323ffa8b09e7ae (diff)
Move event_set_timeout --> tcp_set_connect_timeout.
Diffstat (limited to 'lib/event.c')
-rw-r--r--lib/event.c40
1 files changed, 3 insertions, 37 deletions
diff --git a/lib/event.c b/lib/event.c
index 97a08c8..55a7e6b 100644
--- a/lib/event.c
+++ b/lib/event.c
@@ -14,10 +14,11 @@
#endif
#include <radsec/radsec.h>
#include <radsec/radsec-impl.h>
+#include "tcp.h"
+#include "udp.h"
#if defined (RS_ENABLE_TLS)
#include "tls.h"
#endif
-#include "udp.h"
#include "event.h"
#include "packet.h"
#include "debug.h"
@@ -74,24 +75,6 @@ event_init_socket (struct rs_connection *conn, struct rs_peer *p)
return RSE_OK;
}
-static void
-_conn_timeout_cb (int fd, short event, void *data)
-{
- struct rs_connection *conn;
-
- assert (data);
- conn = (struct rs_connection *) data;
-
- if (event & EV_TIMEOUT)
- {
- 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);
- event_loopbreak (conn);
- }
-}
-
int
event_init_bufferevent (struct rs_connection *conn, struct rs_peer *peer)
{
@@ -155,7 +138,7 @@ event_do_connect (struct rs_connection *conn)
if (p->conn->bev) /* TCP */
{
- event_set_timeout (conn);
+ tcp_set_connect_timeout (conn);
err = bufferevent_socket_connect (p->conn->bev, p->addr->ai_addr,
p->addr->ai_addrlen);
if (err < 0)
@@ -192,23 +175,6 @@ event_loopbreak (struct rs_connection *conn)
}
-int
-event_set_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);
-
- return RSE_OK;
-}
-
void
event_on_disconnect (struct rs_connection *conn)
{