mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-12-25 22:46:34 +08:00
改进在自动读超时模式下的Websocket连接
This commit is contained in:
@@ -94,7 +94,7 @@ func (this *ClientConn) Read(b []byte) (n int, err error) {
|
||||
|
||||
// 设置读超时时间
|
||||
var autoReadTimeout = globalServerConfig != nil && globalServerConfig.Performance.AutoReadTimeout
|
||||
if this.isHTTP && !this.isShortReading && autoReadTimeout {
|
||||
if this.isHTTP && !this.isWebsocket && !this.isShortReading && autoReadTimeout {
|
||||
this.setHTTPReadTimeout()
|
||||
}
|
||||
|
||||
@@ -157,7 +157,7 @@ func (this *ClientConn) Write(b []byte) (n int, err error) {
|
||||
}
|
||||
|
||||
// 延长读超时时间
|
||||
if this.isHTTP {
|
||||
if this.isHTTP && !this.isWebsocket && globalServerConfig != nil && globalServerConfig.Performance.AutoReadTimeout {
|
||||
this.setHTTPReadTimeout()
|
||||
}
|
||||
|
||||
@@ -217,7 +217,7 @@ func (this *ClientConn) SetDeadline(t time.Time) error {
|
||||
func (this *ClientConn) SetReadDeadline(t time.Time) error {
|
||||
// 如果开启了HTTP自动读超时选项,则自动控制超时时间
|
||||
var globalServerConfig = sharedNodeConfig.GlobalServerConfig
|
||||
if this.isHTTP && globalServerConfig != nil && globalServerConfig.Performance.AutoReadTimeout {
|
||||
if this.isHTTP && !this.isWebsocket && globalServerConfig != nil && globalServerConfig.Performance.AutoReadTimeout {
|
||||
this.isShortReading = false
|
||||
|
||||
var unixTime = t.Unix()
|
||||
|
||||
Reference in New Issue
Block a user