Fix stun test
This commit is contained in:
parent
adeea0f707
commit
6bb84ab3a6
1 changed files with 5 additions and 0 deletions
|
|
@ -9,6 +9,8 @@ import (
|
||||||
"net/netip"
|
"net/netip"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/sagernet/sing/common/bufio"
|
||||||
|
"github.com/sagernet/sing/common/bufio/deadline"
|
||||||
E "github.com/sagernet/sing/common/exceptions"
|
E "github.com/sagernet/sing/common/exceptions"
|
||||||
M "github.com/sagernet/sing/common/metadata"
|
M "github.com/sagernet/sing/common/metadata"
|
||||||
N "github.com/sagernet/sing/common/network"
|
N "github.com/sagernet/sing/common/network"
|
||||||
|
|
@ -431,6 +433,9 @@ func Run(options Options) (*Result, error) {
|
||||||
defer func() {
|
defer func() {
|
||||||
_ = packetConn.Close()
|
_ = packetConn.Close()
|
||||||
}()
|
}()
|
||||||
|
if deadline.NeedAdditionalReadDeadline(packetConn) {
|
||||||
|
packetConn = deadline.NewPacketConn(bufio.NewPacketConn(packetConn))
|
||||||
|
}
|
||||||
|
|
||||||
select {
|
select {
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue