mirror of
https://github.com/SagerNet/sing-quic.git
synced 2025-04-03 03:47:39 +03:00
Fix fragUDPMessage
This commit is contained in:
parent
97a8f2ab1c
commit
01f8ce81ac
3 changed files with 6 additions and 6 deletions
|
@ -88,12 +88,12 @@ func (m *udpMessage) headerSize() int {
|
|||
}
|
||||
|
||||
func fragUDPMessage(message *udpMessage, maxPacketSize int) []*udpMessage {
|
||||
if message.data.Len() <= maxPacketSize {
|
||||
udpMTU := maxPacketSize - message.headerSize()
|
||||
if message.data.Len() <= udpMTU {
|
||||
return []*udpMessage{message}
|
||||
}
|
||||
var fragments []*udpMessage
|
||||
originPacket := message.data.Bytes()
|
||||
udpMTU := maxPacketSize - message.headerSize()
|
||||
for remaining := len(originPacket); remaining > 0; remaining -= udpMTU {
|
||||
fragment := allocMessage()
|
||||
*fragment = *message
|
||||
|
|
|
@ -84,12 +84,12 @@ func (m *udpMessage) headerSize() int {
|
|||
}
|
||||
|
||||
func fragUDPMessage(message *udpMessage, maxPacketSize int) []*udpMessage {
|
||||
if message.data.Len() <= maxPacketSize {
|
||||
udpMTU := maxPacketSize - message.headerSize()
|
||||
if message.data.Len() <= udpMTU {
|
||||
return []*udpMessage{message}
|
||||
}
|
||||
var fragments []*udpMessage
|
||||
originPacket := message.data.Bytes()
|
||||
udpMTU := maxPacketSize - message.headerSize()
|
||||
for remaining := len(originPacket); remaining > 0; remaining -= udpMTU {
|
||||
fragment := allocMessage()
|
||||
*fragment = *message
|
||||
|
|
|
@ -86,12 +86,12 @@ func (m *udpMessage) headerSize() int {
|
|||
}
|
||||
|
||||
func fragUDPMessage(message *udpMessage, maxPacketSize int) []*udpMessage {
|
||||
if message.data.Len() <= maxPacketSize {
|
||||
udpMTU := maxPacketSize - message.headerSize()
|
||||
if message.data.Len() <= udpMTU {
|
||||
return []*udpMessage{message}
|
||||
}
|
||||
var fragments []*udpMessage
|
||||
originPacket := message.data.Bytes()
|
||||
udpMTU := maxPacketSize - message.headerSize()
|
||||
for remaining := len(originPacket); remaining > 0; remaining -= udpMTU {
|
||||
fragment := allocMessage()
|
||||
*fragment = *message
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue