mirror of
https://github.com/SagerNet/sing-quic.git
synced 2025-04-03 03:47:39 +03:00
Minor fixes
This commit is contained in:
parent
3c842cd21e
commit
f846946810
6 changed files with 21 additions and 6 deletions
|
@ -400,6 +400,11 @@ func (d *udpDefragger) feed(m *udpMessage) *udpMessage {
|
|||
}
|
||||
item.messages = nil
|
||||
return newMessage
|
||||
} else {
|
||||
newMessage.release()
|
||||
for _, message := range item.messages {
|
||||
message.releaseMessage()
|
||||
}
|
||||
}
|
||||
item.messages = nil
|
||||
return nil
|
||||
|
|
|
@ -20,11 +20,11 @@ func (c *udpPacketConn) WaitReadPacket() (buffer *buf.Buffer, destination M.Sock
|
|||
if c.readWaitOptions.NeedHeadroom() {
|
||||
buffer = c.readWaitOptions.NewPacketBuffer()
|
||||
_, err = buffer.Write(p.data.Bytes())
|
||||
p.releaseMessage()
|
||||
if err != nil {
|
||||
buffer.Release()
|
||||
return nil, M.Socksaddr{}, err
|
||||
return
|
||||
}
|
||||
p.releaseMessage()
|
||||
c.readWaitOptions.PostReturn(buffer)
|
||||
} else {
|
||||
buffer = p.data
|
||||
|
|
|
@ -392,6 +392,11 @@ func (d *udpDefragger) feed(m *udpMessage) *udpMessage {
|
|||
}
|
||||
item.messages = nil
|
||||
return newMessage
|
||||
} else {
|
||||
newMessage.releaseMessage()
|
||||
for _, message := range item.messages {
|
||||
message.releaseMessage()
|
||||
}
|
||||
}
|
||||
item.messages = nil
|
||||
return nil
|
||||
|
|
|
@ -20,11 +20,11 @@ func (c *udpPacketConn) WaitReadPacket() (buffer *buf.Buffer, destination M.Sock
|
|||
if c.readWaitOptions.NeedHeadroom() {
|
||||
buffer = c.readWaitOptions.NewPacketBuffer()
|
||||
_, err = buffer.Write(p.data.Bytes())
|
||||
p.releaseMessage()
|
||||
if err != nil {
|
||||
buffer.Release()
|
||||
return nil, M.Socksaddr{}, err
|
||||
return
|
||||
}
|
||||
p.releaseMessage()
|
||||
c.readWaitOptions.PostReturn(buffer)
|
||||
} else {
|
||||
buffer = p.data
|
||||
|
|
|
@ -437,6 +437,11 @@ func (d *udpDefragger) feed(m *udpMessage) *udpMessage {
|
|||
}
|
||||
item.messages = nil
|
||||
return newMessage
|
||||
} else {
|
||||
newMessage.releaseMessage()
|
||||
for _, message := range item.messages {
|
||||
message.releaseMessage()
|
||||
}
|
||||
}
|
||||
item.messages = nil
|
||||
return nil
|
||||
|
|
|
@ -19,12 +19,12 @@ func (c *udpPacketConn) WaitReadPacket() (buffer *buf.Buffer, destination M.Sock
|
|||
destination = p.destination
|
||||
if c.readWaitOptions.NeedHeadroom() {
|
||||
buffer = c.readWaitOptions.NewPacketBuffer()
|
||||
p.releaseMessage()
|
||||
_, err = buffer.Write(p.data.Bytes())
|
||||
if err != nil {
|
||||
buffer.Release()
|
||||
return nil, M.Socksaddr{}, err
|
||||
return
|
||||
}
|
||||
p.releaseMessage()
|
||||
c.readWaitOptions.PostReturn(buffer)
|
||||
} else {
|
||||
buffer = p.data
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue