From f92750a92b52878f1f6555e0222b7604441f551e Mon Sep 17 00:00:00 2001 From: Dafydd Harries Date: Sat, 20 Jan 2007 03:34:00 +0000 Subject: fake UDP: simplify Packet struct darcs-hash:20070120033445-c9803-09408144ece3f71be9f9631501de29bc4fd5aa39.gz --- udp/udp-fake.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'udp') diff --git a/udp/udp-fake.c b/udp/udp-fake.c index 31a5419..36b51dd 100644 --- a/udp/udp-fake.c +++ b/udp/udp-fake.c @@ -11,8 +11,7 @@ typedef struct _Packet Packet; struct _Packet { - struct sockaddr_in from; - struct sockaddr_in to; + struct sockaddr_in sin; guint len; gchar buf[1024]; }; @@ -54,7 +53,7 @@ fake_send ( packet = g_slice_new0 (Packet); packet->len = len; - packet->to = *to; + packet->sin = *to; strncpy (packet->buf, buf, len); man = (UDPSocketManager *) sock->priv; @@ -87,7 +86,7 @@ fake_recv ( len = packet->len; memcpy (buf, packet->buf, len); - memcpy (from, &(packet->from), sizeof (*from)); + memcpy (from, &(packet->sin), sizeof (*from)); g_slice_free (Packet, packet); return len; @@ -117,7 +116,7 @@ udp_fake_socket_manager_push_recv ( packet = g_slice_new0 (Packet); packet->len = len; - packet->from = *from; + packet->sin = *from; strncpy (packet->buf, buf, len); priv = (UDPFakeSocketManagerPriv *) man->priv; @@ -140,7 +139,7 @@ udp_fake_socket_manager_pop_send ( if (!packet) return 0; - *to = packet->to; + *to = packet->sin; return packet->len; } -- cgit v1.2.1