forked from quic-go/quic-go
10
session.go
10
session.go
@@ -272,10 +272,14 @@ func (s *Session) handlePacketImpl(p *receivedPacket) error {
|
||||
utils.Debugf("<- Reading packet 0x%x (%d bytes) for connection %x @ %s", hdr.PacketNumber, len(data)+len(hdr.Raw), hdr.ConnectionID, time.Now().Format("15:04:05.000"))
|
||||
}
|
||||
|
||||
// TODO: Only do this after authenticating
|
||||
s.conn.setCurrentRemoteAddr(p.remoteAddr)
|
||||
|
||||
packet, err := s.unpacker.Unpack(hdr.Raw, hdr, data)
|
||||
// if the decryption failed, this might be a packet sent by an attacker
|
||||
// don't update the remote address
|
||||
if quicErr, ok := err.(*qerr.QuicError); ok && quicErr.ErrorCode == qerr.DecryptionFailure {
|
||||
return err
|
||||
}
|
||||
// update the remote address, even if unpacking failed for any other reason than a decryption error
|
||||
s.conn.setCurrentRemoteAddr(p.remoteAddr)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user