snoyberg/conduit — pull request #173 by KasperJanssens (2014-09-20 14:00:30+00:00)
Title: Safe run general tcp server

runGeneralTCPServer will now fork the runTCPServer function itself.
Next to that, it will wait until runTCPServer signals that the
server is really accepting requests on the port before returning
control to the caller.

The problem I tried to fix is intermittent failing tests on our jenkins on slower hardware because the server was not accepting connections yet while we were already connecting a client to it. Running a threadDelay is a possible solution but not safe.
Next to that, having a a lot of tests that are all waiting half a second is not something we would like to have.

Through using the afterBind function we can of course also keep this functionality in our own application if you think it doesn't belong in conduit-extra.

I'm a fairly inexperienced haskell developer so the code might be suboptimal/not idiomatic. In that case, just let me know, I'll fix it.