From 8e94f08ee5ab68db6d03d526c0a91e8e0a2c6306 Mon Sep 17 00:00:00 2001 From: Marten Seemann Date: Mon, 11 Jan 2021 15:29:00 +0800 Subject: [PATCH] simplify switch statement in the transport parameter parser --- internal/wire/transport_parameters.go | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/internal/wire/transport_parameters.go b/internal/wire/transport_parameters.go index 459b2e41..c01e2dc9 100644 --- a/internal/wire/transport_parameters.go +++ b/internal/wire/transport_parameters.go @@ -123,24 +123,18 @@ func (p *TransportParameters) unmarshal(r *bytes.Reader, sentBy protocol.Perspec } parameterIDs = append(parameterIDs, paramID) switch paramID { - case ackDelayExponentParameterID: - if err := p.readNumericTransportParameter(r, paramID, int(paramLen)); err != nil { - return err - } - case maxAckDelayParameterID: - if err := p.readNumericTransportParameter(r, paramID, int(paramLen)); err != nil { - return err - } - case initialMaxStreamDataBidiLocalParameterID, + case maxIdleTimeoutParameterID, + maxUDPPayloadSizeParameterID, + initialMaxDataParameterID, + initialMaxStreamDataBidiLocalParameterID, initialMaxStreamDataBidiRemoteParameterID, initialMaxStreamDataUniParameterID, - initialMaxDataParameterID, initialMaxStreamsBidiParameterID, initialMaxStreamsUniParameterID, - maxIdleTimeoutParameterID, - maxUDPPayloadSizeParameterID, + maxAckDelayParameterID, activeConnectionIDLimitParameterID, - maxDatagramFrameSizeParameterID: + maxDatagramFrameSizeParameterID, + ackDelayExponentParameterID: if err := p.readNumericTransportParameter(r, paramID, int(paramLen)); err != nil { return err }