mirror of
https://github.com/daeuniverse/dae.git
synced 2025-02-02 04:14:31 +07:00
fix: udp panic when udpConn is not net.PacketConn
This commit is contained in:
parent
f2d5ed34fb
commit
d67fe075a3
@ -124,6 +124,9 @@ func (p *UdpEndpointPool) GetOrCreate(lAddr netip.AddrPort, createOption *UdpEnd
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, true, err
|
return nil, true, err
|
||||||
}
|
}
|
||||||
|
if _, ok = udpConn.(net.PacketConn); !ok {
|
||||||
|
return nil, true, fmt.Errorf("protocol does not support udp")
|
||||||
|
}
|
||||||
ue = &UdpEndpoint{
|
ue = &UdpEndpoint{
|
||||||
conn: udpConn.(net.PacketConn),
|
conn: udpConn.(net.PacketConn),
|
||||||
deadlineTimer: time.AfterFunc(createOption.NatTimeout, func() {
|
deadlineTimer: time.AfterFunc(createOption.NatTimeout, func() {
|
||||||
|
Loading…
Reference in New Issue
Block a user