diff options
author | Benjamin Franzke <benjaminfranzke@googlemail.com> | 2013-03-13 11:30:47 +0100 |
---|---|---|
committer | Benjamin Franzke <benjaminfranzke@googlemail.com> | 2013-03-13 11:45:51 +0100 |
commit | 4253eaffd2d17a8ae1026e3068985fb8d39feab0 (patch) | |
tree | ebea41b497b67ddad1b3c1a8a0aa494693bfe9fc /econpacket.h | |
parent | 07196ab8ea16d4fd39f54f11088a854543cf27ac (diff) | |
download | econ-4253eaffd2d17a8ae1026e3068985fb8d39feab0.tar.gz econ-4253eaffd2d17a8ae1026e3068985fb8d39feab0.tar.bz2 econ-4253eaffd2d17a8ae1026e3068985fb8d39feab0.zip |
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.
Diffstat (limited to 'econpacket.h')
-rw-r--r-- | econpacket.h | 6 |
1 files changed, 3 insertions, 3 deletions
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 |