优化代码

This commit is contained in:
刘祥超
2022-01-13 11:46:42 +08:00
parent 8177768cf6
commit 2a1cc63989

View File

@@ -67,17 +67,17 @@ func (this *ClientConn) Read(b []byte) (n int, err error) {
// SYN Flood检测
var isHandshakeError = err != nil && os.IsTimeout(err) && !this.hasRead
if isHandshakeError {
_ = this.SetLinger(0)
}
var synFloodConfig = sharedNodeConfig.SYNFloodConfig()
if synFloodConfig != nil && synFloodConfig.IsOn {
if isHandshakeError {
_ = this.SetLinger(0)
this.increaseSYNFlood(synFloodConfig)
} else if err == nil && !this.hasResetSYNFlood {
this.hasResetSYNFlood = true
this.resetSYNFlood()
}
} else if isHandshakeError {
_ = this.SetLinger(0)
}
return