ngmoco/falcore — pull request #16 by dgrijalva (2012-06-05 20:25:18+00:00)
Title: A simpler approach to graceful shutdown

Here's another approach to shutting down gracefully. It still requires a second goroutine, but it doesn't alter control flow. The cost of a completely idle goroutine should be just the size of a single stack frame.

When srv.stopAccepting is closed, the ReadTimeout will be set on the connection. All reads, even an active one, will timeout. This should not affect writes, so the in flight request can still finish.