From 736af5698a5bb602e5dd7edf5126c584d7cca008 Mon Sep 17 00:00:00 2001 From: Marten Seemann Date: Fri, 11 Dec 2020 12:12:17 +0700 Subject: [PATCH] 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. --- session.go | 1 - 1 file changed, 1 deletion(-) diff --git a/session.go b/session.go index 4261d042b..43bf0f433 100644 --- a/session.go +++ b/session.go @@ -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())