localshred/protobuf — pull request #63 by localshred (2013-02-19 22:37:45+00:00)
Title: First cut of the Lazy Pirate client pattern

The ZMQ client connector implements the Lazy Pirate pattern as laid out in
the [ZMQ Guide - Chapter 4][lpp]. The essence is that we attempt to be more
stable in our client requests as we assume the server may not be available
for fulfilling responses.

A connection will be created to the server and data sent with a timeout on
the socket. If the socket becomes readable inside the timeout, we read the
data and go on our way.

If the socket does not become readable in the timeout, we will close and
reopen the socket, send the data again, and again wait for a valid response
or timeout.

If we exceed the number of tries we do not attempt the connection anymore and
we fail with a timeout message to the calling code.

[lpp]:

http://zguide.zeromq.org/php:chapter4#Client-side-Reliability-Lazy-Pirate-Pattern