docker/libchan — pull request #57 by lynxbat (2014-09-03 19:40:59+00:00)
Title: Dead session detection

This PR adds a feature to handle unreliable client connections within a server implementation.

If a client loses connection or closes their connection poorly a server goroutine can get stuck waiting on a blocking method. Over a period of time these waiting routines stack up. In a server that handles a high frequency of sessions even a smaller session failure rate can add up quickly.

This PR adds the following features:
* A timeout option for listener. It will return an error from spdy.TransportListener.AcceptTransport() if the timeout expires before an initial connection is opened.
* A heartbeat for spdy.Transport.WaitReceiveChannel() that will trigger an error if the client session is detected as dead.
* A heartbeat for spdy.channel.Receive() that will trigger an error like the above.

This provides the ability to handle client dead session for each of the blocking methods run inside a server goroutine allowing the goroutine for that session to exit gracefully.

Notes:
* Tests are provided and show the usage.
* Heartbeat defaults to 30 second pings with a failure limit of 3 lost pings in a row (120 seconds)
* Heartbeat can be overridden by each server for both ping interval and failure limit.
* Heartbeat uses the spdystream.Connection.Ping() method.

Docker-DCO-1.1-Signed-off-by: Nicholas Weaver (github: lynxbat)