throw an error if the peer tries to open a too high stream

This commit is contained in:
Marten Seemann 2018-02-04 19:34:35 +08:00
parent 46e20ce8c9
commit e36b8d8e30
5 changed files with 59 additions and 13 deletions

View file

@ -2,6 +2,7 @@ package quic
import (
"fmt"
"math"
"github.com/lucas-clemente/quic-go/internal/flowcontrol"
"github.com/lucas-clemente/quic-go/internal/handshake"
@ -65,9 +66,11 @@ func newStreamsMap(
return newReceiveStream(id, m.sender, m.newFlowController(id), version)
}
m.outgoingBidiStreams = newOutgoingBidiStreamsMap(firstOutgoingBidiStream, newBidiStream)
m.incomingBidiStreams = newIncomingBidiStreamsMap(firstIncomingBidiStream, newBidiStream)
// TODO(#1150): use a reasonable stream limit
m.incomingBidiStreams = newIncomingBidiStreamsMap(firstIncomingBidiStream, protocol.StreamID(math.MaxUint32), newBidiStream)
m.outgoingUniStreams = newOutgoingUniStreamsMap(firstOutgoingUniStream, newUniSendStream)
m.incomingUniStreams = newIncomingUniStreamsMap(firstIncomingUniStream, newUniReceiveStream)
// TODO(#1150): use a reasonable stream limit
m.incomingUniStreams = newIncomingUniStreamsMap(firstIncomingUniStream, protocol.StreamID(math.MaxUint32), newUniReceiveStream)
return m
}