mirror of
https://github.com/SagerNet/sing.git
synced 2025-04-04 20:37:40 +03:00
Fix canceler.PacketConn
This commit is contained in:
parent
10f242e3c9
commit
c88be7da10
1 changed files with 2 additions and 2 deletions
|
@ -21,13 +21,13 @@ type TimerPacketConn struct {
|
||||||
instance *Instance
|
instance *Instance
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewPacketConn(ctx context.Context, conn N.PacketConn, timeout time.Duration) (context.Context, PacketConn) {
|
func NewPacketConn(ctx context.Context, conn N.PacketConn, timeout time.Duration) (context.Context, N.PacketConn) {
|
||||||
if timeoutConn, isTimeoutConn := common.Cast[PacketConn](conn); isTimeoutConn {
|
if timeoutConn, isTimeoutConn := common.Cast[PacketConn](conn); isTimeoutConn {
|
||||||
oldTimeout := timeoutConn.Timeout()
|
oldTimeout := timeoutConn.Timeout()
|
||||||
if timeout < oldTimeout {
|
if timeout < oldTimeout {
|
||||||
timeoutConn.SetTimeout(timeout)
|
timeoutConn.SetTimeout(timeout)
|
||||||
}
|
}
|
||||||
return ctx, timeoutConn
|
return ctx, conn
|
||||||
}
|
}
|
||||||
err := conn.SetReadDeadline(time.Time{})
|
err := conn.SetReadDeadline(time.Time{})
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue