From b67819ac8154b728039d9b4a9e7e21d881642ec4 Mon Sep 17 00:00:00 2001 From: Erik Ekman Date: Sat, 1 Dec 2007 23:05:54 +0000 Subject: [PATCH] use packet functions for empty check and fill --- src/iodined.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/iodined.c b/src/iodined.c index 83ed538..151126c 100644 --- a/src/iodined.c +++ b/src/iodined.c @@ -82,10 +82,8 @@ tunnel_tun(int tun_fd, int dns_fd) compress2((uint8_t*)out, &outlen, (uint8_t*)in, read, 9); /* if another packet is queued, throw away this one. TODO build queue */ - if (users[userid].outpacket.len == 0) { - memcpy(users[userid].outpacket.data, out, outlen); - users[userid].outpacket.len = outlen; - return outlen; + if (packet_empty(&(users[userid].outpacket))) { + return packet_fill(&(users[userid].outpacket), out, outlen); } else { return 0; }