don't preallocate a slice for undecryptable packets

Under normal conditions, we don't expect to receive any undecryptable
packets. We expect to receive a few when there's packet loss and / or
reordering during the handshake, but even in that case the number will
most likely be smaller than protocol.MaxUndecryptablePackets.
This commit is contained in:
Marten Seemann
2020-12-11 12:12:17 +07:00
parent deacefdd34
commit 736af5698a

View File

@@ -493,7 +493,6 @@ func (s *session) preSetup() {
s.receivedPackets = make(chan *receivedPacket, protocol.MaxSessionUnprocessedPackets)
s.closeChan = make(chan closeError, 1)
s.sendingScheduled = make(chan struct{}, 1)
s.undecryptablePackets = make([]*receivedPacket, 0, protocol.MaxUndecryptablePackets)
s.ctx, s.ctxCancel = context.WithCancel(context.Background())
s.handshakeCtx, s.handshakeCtxCancel = context.WithCancel(context.Background())