client: use single write for admin commands
commit5d18499348d31dfea1c34df759d830631518e48f
authorEric Wong <e@80x24.org>
Fri, 7 Apr 2017 00:14:23 +0000 (7 00:14 +0000)
committerEric Wong <e@80x24.org>
Fri, 7 Apr 2017 00:36:08 +0000 (7 00:36 +0000)
tree593d8d34283da1bca8478345333a0543e4c0ad79
parent05cdf17041374690f588a3efe381a3463a44d013
client: use single write for admin commands

This avoids the odd case where the first write completes, but
the second one (for 3 bytes: ".\r\n") does not complete, causing
a client to having both read and write watchability enabled
after the previous commit to stop reads when writes do not
complete.

This would not be fatal, but breaks the rule where clients
should only be reading or writing exclusively, never doing
both; as that could lead to pathological memory usage.

This also reduces client wakeups and TCP overhead with
TCP_NODELAY sockets by avoiding a small packet (".\r\n")
after the main response.
lib/MogileFS/Connection/Client.pm