mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2024-11-16 11:42:43 +08:00
Fix: io timeout when snell v2 reuse connection (#1362)
This commit is contained in:
parent
d9341a49ea
commit
df5112175f
|
@ -3,6 +3,7 @@ package snell
|
|||
import (
|
||||
"context"
|
||||
"net"
|
||||
"time"
|
||||
|
||||
"github.com/Dreamacro/clash/component/pool"
|
||||
|
||||
|
@ -61,6 +62,9 @@ func (pc *PoolConn) Write(b []byte) (int, error) {
|
|||
}
|
||||
|
||||
func (pc *PoolConn) Close() error {
|
||||
// clash use SetReadDeadline to break bidirectional copy between client and server.
|
||||
// reset it before reuse connection to avoid io timeout error.
|
||||
pc.Snell.Conn.SetReadDeadline(time.Time{})
|
||||
pc.pool.Put(pc.Snell)
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user