summaryrefslogtreecommitdiff
path: root/lib/udp.c
diff options
context:
space:
mode:
authorLinus Nordberg <linus@nordu.net>2011-03-10 08:08:32 +0100
committerLinus Nordberg <linus@nordu.net>2011-03-10 08:08:32 +0100
commit1a1e09bd5def4fae2a499294535b37805f79fde8 (patch)
tree3726fe2e84485d405a9d09500b0215da933d1b47 /lib/udp.c
parenta48992622d54c6d5dbf5abe3022cfe5b06167261 (diff)
[UDP] Don't crash on second packet.
[UDP] Set the user_data member for the write callback in rs_packet_send() -- the one from udp_init() doesn't do much good at this point.
Diffstat (limited to 'lib/udp.c')
-rw-r--r--lib/udp.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/udp.c b/lib/udp.c
index 19968b3..911616d 100644
--- a/lib/udp.c
+++ b/lib/udp.c
@@ -128,6 +128,7 @@ _evcb (evutil_socket_t fd, short what, void *user_data)
{
struct rs_packet *pkt = (struct rs_packet *) user_data;
assert (pkt);
+ assert (pkt->conn);
if (!pkt->conn->is_connected)
event_on_connect (pkt->conn, pkt);
@@ -150,7 +151,7 @@ udp_init (struct rs_connection *conn, struct rs_packet *pkt)
assert (!conn->bev);
conn->rev = event_new (conn->evb, conn->fd, EV_READ|EV_PERSIST, _evcb, NULL);
- conn->wev = event_new (conn->evb, conn->fd, EV_WRITE, _evcb, pkt);
+ conn->wev = event_new (conn->evb, conn->fd, EV_WRITE, _evcb, NULL);
if (!conn->rev || !conn->wev)
{
if (conn->rev)