mirror of
https://github.com/SagerNet/sing.git
synced 2025-04-03 03:47:38 +03:00
Fix set timeout
This commit is contained in:
parent
c44912a861
commit
4ba1eb123c
1 changed files with 1 additions and 1 deletions
|
@ -24,7 +24,7 @@ type TimerPacketConn struct {
|
||||||
func NewPacketConn(ctx context.Context, conn N.PacketConn, timeout time.Duration) (context.Context, N.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 oldTimeout > 0 && timeout >= oldTimeout {
|
||||||
return ctx, conn
|
return ctx, conn
|
||||||
}
|
}
|
||||||
if timeoutConn.SetTimeout(timeout) {
|
if timeoutConn.SetTimeout(timeout) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue