Fix: io timeout when snell v2 reuse connection (#1362)
This commit is contained in:
parent
b03a27b74c
commit
226e6d1b4d
1 changed files with 4 additions and 0 deletions
|
@ -3,6 +3,7 @@ package snell
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"net"
|
"net"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/Dreamacro/clash/component/pool"
|
"github.com/Dreamacro/clash/component/pool"
|
||||||
|
|
||||||
|
@ -61,6 +62,9 @@ func (pc *PoolConn) Write(b []byte) (int, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (pc *PoolConn) Close() 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)
|
pc.pool.Put(pc.Snell)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue