redding/dat-tcp — pull request #4 by jcredding (2013-02-06 20:41:32+00:00)
Title: Re-organize DatTCP's API methods for more control

This modifies DatTCP's API methods to allow more control of the
server.

* Added `pause` for stopping the server's work loop but still
leaving the TCP connection open (so requests can queue up).
* Added `halt` for a non-graceful stopping of the server.
* Renamed `start` to `run` to line up with the `running?` state.
* `run` returns the thread it creates. This can then be joined,
so the method `join_thread` is no longer needed. I prefered
how this reads and it's one less method to support.
* Broke up the pieces of 'shutting down the server'. This is to
support the different ways of shutting down (`pause`, `stop` and
`halt`).
* Modified `Workers` to take a serve proc when it's created instead
of everytime we accept a connection. I felt this was cleaner and
slightly more efficient not having to create a new proc for every
connection.

@kellyredding - The `pause` method is the meat of what is needed to support hot restarts. The rest of it is mostly things I saw in puma that I liked. I'm going to try to steal a few more ideas from puma's thread pool and apply them to the workers and see if there's any improvements, but that will appear in another PR.