设置客户端连接linger为0

This commit is contained in:
GoEdgeLab
2021-10-20 22:32:02 +08:00
parent e4be419c54
commit aa7f917678
4 changed files with 30 additions and 24 deletions

View File

@@ -20,7 +20,7 @@ func (this *HTTPRequest) doWAFRequest() (blocked bool) {
// 当前连接是否已关闭
var conn = this.RawReq.Context().Value(HTTPConnContextKey)
if conn != nil {
trafficConn, ok := conn.(*TrafficConn)
trafficConn, ok := conn.(*ClientConn)
if ok && trafficConn.IsClosed() {
this.disableLog = true
return true
@@ -32,7 +32,7 @@ func (this *HTTPRequest) doWAFRequest() (blocked bool) {
this.disableLog = true
if conn != nil {
trafficConn, ok := conn.(*TrafficConn)
trafficConn, ok := conn.(*ClientConn)
if ok && !trafficConn.IsClosed() {
_ = trafficConn.Close()
}