mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-04-04 04:37:36 +03:00
pass around receivedPacket as struct instead of as pointer (#3823)
This commit is contained in:
parent
591ab1ab5e
commit
072a602cc1
16 changed files with 96 additions and 94 deletions
|
@ -79,16 +79,16 @@ type basicConn struct {
|
|||
|
||||
var _ rawConn = &basicConn{}
|
||||
|
||||
func (c *basicConn) ReadPacket() (*receivedPacket, error) {
|
||||
func (c *basicConn) ReadPacket() (receivedPacket, error) {
|
||||
buffer := getPacketBuffer()
|
||||
// The packet size should not exceed protocol.MaxPacketBufferSize bytes
|
||||
// If it does, we only read a truncated packet, which will then end up undecryptable
|
||||
buffer.Data = buffer.Data[:protocol.MaxPacketBufferSize]
|
||||
n, addr, err := c.PacketConn.ReadFrom(buffer.Data)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return receivedPacket{}, err
|
||||
}
|
||||
return &receivedPacket{
|
||||
return receivedPacket{
|
||||
remoteAddr: addr,
|
||||
rcvTime: time.Now(),
|
||||
data: buffer.Data[:n],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue