From 4253eaffd2d17a8ae1026e3068985fb8d39feab0 Mon Sep 17 00:00:00 2001 From: Benjamin Franzke Date: Wed, 13 Mar 2013 11:30:47 +0100 Subject: econpacket: Have to use different read strategies for udp and tcp UDP needs to read the complete packet in one read, so the read size >= packet_size. TCP reads more that one packet if size > packet_size, which we dont want. So do parital reads for tcp, and real it all at once for udp sockets. --- econpacket.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'econpacket.h') diff --git a/econpacket.h b/econpacket.h index eccb453..fc4aea4 100644 --- a/econpacket.h +++ b/econpacket.h @@ -26,14 +26,14 @@ struct econ_packet { struct econ_command cmd; struct econ_record rec; - /* Holding the previous elements */ - struct iovec iov[4]; - /* Storage for irregular long commands. * This is just the remaining part, the first * bytes are stored in cmd and rec. */ char long_data[1024]; size_t long_data_size; + + /* Holding the previous elements */ + struct iovec iov[4]; }; void -- cgit