Skip to content
This repository has been archived by the owner on Mar 28, 2019. It is now read-only.

Commit

Permalink
Clarify terminal states; HTTP keep-alive behavior.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kit Cambridge committed Jan 30, 2015
1 parent b51bfd7 commit 65e7cba
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/github.com/mozilla-services/pushgo/simplepush/net.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,9 @@ func (c *limitConn) Close() error {
return err
}

// isTerminalState indicates whether state is a terminal connection state.
// isTerminalState indicates whether state is the last connection state for
// which the http.Server.ConnState hook will be called. This is used by
// ServeCloser to remove tracked connections from its map.
func isTerminalState(state http.ConnState) bool {
return state == http.StateClosed || state == http.StateHijacked
}
Expand Down Expand Up @@ -160,6 +162,8 @@ func (s *ServeCloser) Close() error {
}

func (s *ServeCloser) close() error {
// Disable HTTP keep-alive for requests handled before the underlying
// connections are closed.
s.SetKeepAlivesEnabled(false)
s.connsLock.Lock()
defer s.connsLock.Unlock()
Expand Down

0 comments on commit 65e7cba

Please sign in to comment.