On 30 Jan 2017, at 21:13, Denis Kudriashov <dionisiydk@gmail.com> wrote:
2017-01-30 20:25 GMT+01:00 Sven Van Caekenberghe <sven@stfx.eu>: Well, you should do your utmost best to prevent the situation in the first place (use startup/shutdown behaviour correctly).
I remember I had those problems a lot in the beginning of Zn, especially when running tests that sometimes failed.
Have you seen Zn's #isListening ? I think that was written to catch the case you described, but I am not sure it is 100% rock solid.
Yes. This is exactly how I fix my case. But this post is about general problem which I think is very critical.
In #isListening code I see extra condition "self serverSocket localPort = self port". Could you explain what case it is covered?
IIRC, the idea was that if you bind/listen unsuccessfully, that condition is not true, but again, it was a long time ago, and maybe is not bullet proof.