localshred/protobuf — pull request #65 by devin-c (2013-02-21 01:18:02+00:00)
Title: use inproc socket for backend and cleanup broker

By using an inproc socket for backend communication we can speed up the
interprocess communication. From the 0MQ guide:

> The inter-thread transport, inproc, is a connected signaling
> transport. It is much faster than tcp or ipc.

I also cleaned up the implementation of the broker. It was juggling more
data than it needed to--replicating functionality the router and dealer
sockets already provide. This removes the workers ready message that was
being sent to the broker, but it didn't appear to be useful. The broker
doesn't need to know how many workers are waiting for jobs. If there are
zero, the call to Broker#poll will block until the first worker is
ready. This could have caused the process to hang on shutdown. I
alleviated this by moving the call to Broker#teardown into the
Server#stop method. Any blocking calls will return immediately when the
teardown function closes the brokers sockets.