summaryrefslogtreecommitdiff
path: root/lib/tcp.c
diff options
context:
space:
mode:
authorLinus Nordberg <linus@nordberg.se>2013-03-01 14:34:21 +0100
committerLinus Nordberg <linus@nordberg.se>2013-03-01 14:34:21 +0100
commitf3252b34114236c65624862d2a572f5e290e8cc8 (patch)
tree7a7f720b89443c1cd2dd80290ed039e10d0f7d67 /lib/tcp.c
parentcb9748d119ec0ebd4e8e1bbecb5ef86a65a56061 (diff)
Revamping for listeners.
Split rs_connection into rs_baseconn plus rs_connection and rs_listener. Connections now has a state variable. Connect buffer event and fd of _source_ connection, not that of conn->active_peer. The connection object referred to by a peer is not meant for using as a connection, only for reporting errors on. Make sure things are sane even when not using a config file. Bump library interface version to 1.0.0 since it's changed.
Diffstat (limited to 'lib/tcp.c')
-rw-r--r--lib/tcp.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/tcp.c b/lib/tcp.c
index b8d7906..f5673f5 100644
--- a/lib/tcp.c
+++ b/lib/tcp.c
@@ -109,7 +109,8 @@ _read_message (struct rs_message *msg)
/* Find out what happens if there's data left in the buffer. */
{
size_t rest = 0;
- rest = evbuffer_get_length (bufferevent_get_input (msg->conn->bev));
+ rest =
+ evbuffer_get_length (bufferevent_get_input (msg->conn->base_.bev));
if (rest)
rs_debug (("%s: returning with %d octets left in buffer\n", __func__,
rest));
@@ -178,11 +179,10 @@ tcp_event_cb (struct bufferevent *bev, short events, void *user_data)
assert (msg->conn);
conn = msg->conn;
#if defined (DEBUG)
- assert (msg->conn->active_peer);
- p = conn->active_peer;
+ assert (msg->conn->base_.active_peer);
+ p = conn->base_.active_peer;
#endif
- conn->is_connecting = 0;
if (events & BEV_EVENT_CONNECTED)
{
if (conn->tev)
@@ -213,7 +213,7 @@ tcp_event_cb (struct bufferevent *bev, short events, void *user_data)
}
else
{
- rs_debug (("%s: %d: %d (%s)\n", __func__, conn->fd, sockerr,
+ rs_debug (("%s: %d: %d (%s)\n", __func__, conn->base_.fd, sockerr,
evutil_socket_error_to_string (sockerr)));
rs_err_conn_push_fl (conn, RSE_SOCKERR, __FILE__, __LINE__,
"%d: %d (%s)", conn->base_.fd, sockerr,