zeromq/majordomo — pull request #46 by kevinoid (2013-12-30 19:15:19+00:00)
Title: Disconnecting worker from broker

This pull request fixes #45 by sending DISCONNECT when the worker is destroyed and adding a linger time to ensure the DISCONNECT is actually transmitted.

Unfortunately, although this does address the specific issue of #45, it doesn't address the more fundamental issue of how to "cleanly" disconnect from a broker without losing any requests. At any point the worker calls `mdp_worker_destroy` there may be more requests which have been sent, or are being sent by the broker, that will be discarded. However, I don't see a way to work around this without adding some sort of advisory disconnect message to the protocol (semantically "I am going to disconnect once I finish currently queued requests, stop sending me more requests"). However, that being said, I think these commits are a step in the right direction.