Merge pull request #2995 from lucas-clemente/simplify-tp-parsing-switch

simplify switch statement in the transport parameter parser
This commit is contained in:
Marten Seemann 2021-01-15 17:05:59 +08:00 committed by GitHub
commit cafa7c45d0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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
}