common/io: Rewrite socket handling code to read all available data
commita2abdc13531bdd874df3c6d410370d52e24307fd
authorAmitay Isaacs <amitay@gmail.com>
Thu, 17 Jan 2013 23:42:14 +0000 (18 10:42 +1100)
committerAmitay Isaacs <amitay@gmail.com>
Tue, 19 Feb 2013 06:18:21 +0000 (19 17:18 +1100)
tree0cef96655f7705f4ae34c72c955f269ad9d19c94
parentf9bbbaef7e4cb4affa046e938e28085d94d1b34c
common/io: Rewrite socket handling code to read all available data

This improves the processing of packets considerably.  It has been
observed that there can be as many as 10 packets in the socket buffer and
the current code of reading a single packet from a socket at a time is
not very optimal.  This change reads all the bytes from socket buffer and
then parses to extract multiple packets.  If there are multiple packets,
set up a timed event to process next packet.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
(This used to be ctdb commit d788bc8f7212b7dc1587ae592242dc8c876f4053)
ctdb/common/ctdb_io.c