nanomsg/nanomsg — pull request #295 by TTimo (2014-07-31 20:48:22+00:00)
Title: Issue 182

This is our proposed fix for issue 182 https://github.com/nanomsg/nanomsg/issues/182

We also provide a test case.

nn_recv calls will return ECONNRESET when the PUB side is disconnected, allowing the user to reconnect.

Before the fix, a blocking nn_recv would never return and a non blocking one would say that no data is available forever.

Poking at the socket statistics was the easiest way to identify the problem and react to the situation.