Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Optimize server connection close logic (valyala#1310)
* server.go Make code more clear Inline isHTTP11 var. Use direct Header.SetConnectionClose() and Header.ConnectionClose() * server.go Use direct SetConnectionClose() The SetCanonical(strConnection, strClose) call internally will anyway call SetConnectionClose(). The "Connection: close" will be printed in the ResponseHeader.AppendBytes() * server.go Simplify connectionClose evaluation The conn limit check merged into connectionClose evaluation. This improves performance for most cases: 1. If the connectionClose already true then the conn limit check won't be performed. 2. The SetConnectionClose() was duplicated 3. First check conn limit and only then check for resp.connClose because most users don't close conns manually. 4. We may optimize more: If the resp.connClose = true then SetConnectionClose() not needed but as mentioned above this is a rare case.
- Loading branch information