Skip to content

Instantly share code, notes, and snippets.

@igm
Created December 10, 2012 21:55
Show Gist options
  • Save igm/4253724 to your computer and use it in GitHub Desktop.
Save igm/4253724 to your computer and use it in GitHub Desktop.
Active Connection Guards
func (c *conn) activeConnectionGuard(conn_closed <-chan bool) {
for {
select {
case httpTx := <-c.httpTransactions:
httpTx.writePrelude(httpTx.rw)
httpTx.writeClose(httpTx.rw, 2010, "Another connection still open")
httpTx.done <- true
case <-conn_closed:
return
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment