mirror of
https://github.com/SagerNet/sing-quic.git
synced 2025-04-03 03:47:39 +03:00
Fix reset UDP MTU
This commit is contained in:
parent
01f8ce81ac
commit
5eccd25e3c
3 changed files with 6 additions and 6 deletions
|
@ -208,7 +208,7 @@ func (c *udpPacketConn) WritePacket(buffer *buf.Buffer, destination M.Socksaddr)
|
|||
if !errors.As(err, &tooLargeErr) {
|
||||
return err
|
||||
}
|
||||
return c.writePackets(fragUDPMessage(message, int(tooLargeErr)))
|
||||
return c.writePackets(fragUDPMessage(message, int(tooLargeErr)-3))
|
||||
}
|
||||
|
||||
func (c *udpPacketConn) WriteTo(p []byte, addr net.Addr) (n int, err error) {
|
||||
|
@ -246,7 +246,7 @@ func (c *udpPacketConn) WriteTo(p []byte, addr net.Addr) (n int, err error) {
|
|||
if !errors.As(err, &tooLargeErr) {
|
||||
return
|
||||
}
|
||||
err = c.writePackets(fragUDPMessage(message, int(tooLargeErr)))
|
||||
err = c.writePackets(fragUDPMessage(message, int(tooLargeErr)-3))
|
||||
if err == nil {
|
||||
return len(p), nil
|
||||
}
|
||||
|
|
|
@ -203,7 +203,7 @@ func (c *udpPacketConn) WritePacket(buffer *buf.Buffer, destination M.Socksaddr)
|
|||
if !errors.As(err, &tooLargeErr) {
|
||||
return err
|
||||
}
|
||||
return c.writePackets(fragUDPMessage(message, int(tooLargeErr)))
|
||||
return c.writePackets(fragUDPMessage(message, int(tooLargeErr)-3))
|
||||
}
|
||||
|
||||
func (c *udpPacketConn) WriteTo(p []byte, addr net.Addr) (n int, err error) {
|
||||
|
@ -239,7 +239,7 @@ func (c *udpPacketConn) WriteTo(p []byte, addr net.Addr) (n int, err error) {
|
|||
if !errors.As(err, &tooLargeErr) {
|
||||
return
|
||||
}
|
||||
err = c.writePackets(fragUDPMessage(message, int(tooLargeErr)))
|
||||
err = c.writePackets(fragUDPMessage(message, int(tooLargeErr)-3))
|
||||
if err == nil {
|
||||
return len(p), nil
|
||||
}
|
||||
|
|
|
@ -227,7 +227,7 @@ func (c *udpPacketConn) WritePacket(buffer *buf.Buffer, destination M.Socksaddr)
|
|||
if !errors.As(err, &tooLargeErr) {
|
||||
return err
|
||||
}
|
||||
c.udpMTU = int(tooLargeErr)
|
||||
c.udpMTU = int(tooLargeErr) - 3
|
||||
c.udpMTUTime = time.Now()
|
||||
return c.writePackets(fragUDPMessage(message, c.udpMTU))
|
||||
}
|
||||
|
@ -269,7 +269,7 @@ func (c *udpPacketConn) WriteTo(p []byte, addr net.Addr) (n int, err error) {
|
|||
if !errors.As(err, &tooLargeErr) {
|
||||
return
|
||||
}
|
||||
c.udpMTU = int(tooLargeErr)
|
||||
c.udpMTU = int(tooLargeErr) - 3
|
||||
c.udpMTUTime = time.Now()
|
||||
err = c.writePackets(fragUDPMessage(message, c.udpMTU))
|
||||
if err == nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue