summaryrefslogtreecommitdiff
path: root/lib/send.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/send.c')
-rw-r--r--lib/send.c38
1 files changed, 20 insertions, 18 deletions
diff --git a/lib/send.c b/lib/send.c
index 1234fdd..6b76958 100644
--- a/lib/send.c
+++ b/lib/send.c
@@ -1,4 +1,4 @@
-/* Copyright 2011 NORDUnet A/S. All rights reserved.
+/* Copyright 2011,2013 NORDUnet A/S. All rights reserved.
See LICENSE for licensing information. */
#if defined HAVE_CONFIG_H
@@ -32,8 +32,8 @@ _conn_open (struct rs_connection *conn, struct rs_message *msg)
if (event_init_socket (conn, conn->active_peer))
return -1;
- if (conn->realm->type == RS_CONN_TYPE_TCP
- || conn->realm->type == RS_CONN_TYPE_TLS)
+ if (conn->base_.realm->type == RS_CONN_TYPE_TCP
+ || conn->base_.realm->type == RS_CONN_TYPE_TLS)
{
if (tcp_init_connect_timer (conn))
return -1;
@@ -68,10 +68,10 @@ _wcb (void *user_data)
struct rs_message *msg = (struct rs_message *) user_data;
assert (msg);
msg->flags |= RS_MESSAGE_SENT;
- if (msg->conn->bev)
- bufferevent_disable (msg->conn->bev, EV_WRITE|EV_READ);
+ if (msg->conn->base_.bev)
+ bufferevent_disable (msg->conn->base_.bev, EV_WRITE|EV_READ);
else
- event_del (msg->conn->wev);
+ event_del (msg->conn->base_.wev);
}
int
@@ -90,22 +90,24 @@ rs_message_send (struct rs_message *msg, void *user_data)
if (_conn_open (conn, msg))
return -1;
- assert (conn->evb);
+ assert (conn->base_.ctx);
+ assert (conn->base_.ctx->evb);
assert (conn->active_peer);
- assert (conn->fd >= 0);
+ assert (conn->base_.fd >= 0);
- conn->user_data = user_data;
+ conn->base_.user_data = user_data;
- if (conn->bev) /* TCP */
+ if (conn->base_.bev) /* TCP */
{
- bufferevent_setcb (conn->bev, NULL, tcp_write_cb, tcp_event_cb, msg);
- bufferevent_enable (conn->bev, EV_WRITE);
+ bufferevent_setcb (conn->base_.bev, NULL, tcp_write_cb, tcp_event_cb, msg);
+ bufferevent_enable (conn->base_.bev, EV_WRITE);
}
else /* UDP */
{
- event_assign (conn->wev, conn->evb, event_get_fd (conn->wev),
- EV_WRITE, event_get_callback (conn->wev), msg);
- err = event_add (conn->wev, NULL);
+ event_assign (conn->base_.wev, conn->base_.ctx->evb,
+ event_get_fd (conn->base_.wev),
+ EV_WRITE, event_get_callback (conn->base_.wev), msg);
+ err = event_add (conn->base_.wev, NULL);
if (err < 0)
return rs_err_conn_push_fl (conn, RSE_EVENT, __FILE__, __LINE__,
"event_add: %s",
@@ -116,16 +118,16 @@ rs_message_send (struct rs_message *msg, void *user_data)
if (!conn_user_dispatch_p (conn))
{
conn->callbacks.sent_cb = _wcb;
- conn->user_data = msg;
+ conn->base_.user_data = msg;
rs_debug (("%s: entering event loop\n", __func__));
- err = event_base_dispatch (conn->evb);
+ err = event_base_dispatch (conn->base_.ctx->evb);
if (err < 0)
return rs_err_conn_push_fl (conn, RSE_EVENT, __FILE__, __LINE__,
"event_base_dispatch: %s",
evutil_gai_strerror (err));
rs_debug (("%s: event loop done\n", __func__));
conn->callbacks.sent_cb = NULL;
- conn->user_data = NULL;
+ conn->base_.user_data = NULL;
if ((msg->flags & RS_MESSAGE_SENT) == 0)
{