mirror of
https://github.com/SagerNet/sing-quic.git
synced 2025-04-05 12:57: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 {
|
func fragUDPMessage(message *udpMessage, maxPacketSize int) []*udpMessage {
|
||||||
if message.data.Len() <= maxPacketSize {
|
udpMTU := maxPacketSize - message.headerSize()
|
||||||
|
if message.data.Len() <= udpMTU {
|
||||||
return []*udpMessage{message}
|
return []*udpMessage{message}
|
||||||
}
|
}
|
||||||
var fragments []*udpMessage
|
var fragments []*udpMessage
|
||||||
originPacket := message.data.Bytes()
|
originPacket := message.data.Bytes()
|
||||||
udpMTU := maxPacketSize - message.headerSize()
|
|
||||||
for remaining := len(originPacket); remaining > 0; remaining -= udpMTU {
|
for remaining := len(originPacket); remaining > 0; remaining -= udpMTU {
|
||||||
fragment := allocMessage()
|
fragment := allocMessage()
|
||||||
*fragment = *message
|
*fragment = *message
|
||||||
|
|
|
@ -84,12 +84,12 @@ func (m *udpMessage) headerSize() int {
|
||||||
}
|
}
|
||||||
|
|
||||||
func fragUDPMessage(message *udpMessage, maxPacketSize int) []*udpMessage {
|
func fragUDPMessage(message *udpMessage, maxPacketSize int) []*udpMessage {
|
||||||
if message.data.Len() <= maxPacketSize {
|
udpMTU := maxPacketSize - message.headerSize()
|
||||||
|
if message.data.Len() <= udpMTU {
|
||||||
return []*udpMessage{message}
|
return []*udpMessage{message}
|
||||||
}
|
}
|
||||||
var fragments []*udpMessage
|
var fragments []*udpMessage
|
||||||
originPacket := message.data.Bytes()
|
originPacket := message.data.Bytes()
|
||||||
udpMTU := maxPacketSize - message.headerSize()
|
|
||||||
for remaining := len(originPacket); remaining > 0; remaining -= udpMTU {
|
for remaining := len(originPacket); remaining > 0; remaining -= udpMTU {
|
||||||
fragment := allocMessage()
|
fragment := allocMessage()
|
||||||
*fragment = *message
|
*fragment = *message
|
||||||
|
|
|
@ -86,12 +86,12 @@ func (m *udpMessage) headerSize() int {
|
||||||
}
|
}
|
||||||
|
|
||||||
func fragUDPMessage(message *udpMessage, maxPacketSize int) []*udpMessage {
|
func fragUDPMessage(message *udpMessage, maxPacketSize int) []*udpMessage {
|
||||||
if message.data.Len() <= maxPacketSize {
|
udpMTU := maxPacketSize - message.headerSize()
|
||||||
|
if message.data.Len() <= udpMTU {
|
||||||
return []*udpMessage{message}
|
return []*udpMessage{message}
|
||||||
}
|
}
|
||||||
var fragments []*udpMessage
|
var fragments []*udpMessage
|
||||||
originPacket := message.data.Bytes()
|
originPacket := message.data.Bytes()
|
||||||
udpMTU := maxPacketSize - message.headerSize()
|
|
||||||
for remaining := len(originPacket); remaining > 0; remaining -= udpMTU {
|
for remaining := len(originPacket); remaining > 0; remaining -= udpMTU {
|
||||||
fragment := allocMessage()
|
fragment := allocMessage()
|
||||||
*fragment = *message
|
*fragment = *message
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue