use packet functions for empty check and fill

This commit is contained in:
Erik Ekman 2007-12-01 23:05:54 +00:00 committed by Erik Ekman
parent a114ab3ff9
commit b67819ac81

View file

@ -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;
}