mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-04-03 20:27:35 +03:00
simplify stream number calculation when sending STREAM_ID_BLOCKED frames
This commit is contained in:
parent
82acc7f2b7
commit
b0b8990dd0
3 changed files with 18 additions and 27 deletions
|
@ -82,17 +82,14 @@ func (m *outgoingBidiStreamsMap) OpenStreamSync() (streamI, error) {
|
|||
func (m *outgoingBidiStreamsMap) openStreamImpl() (streamI, error) {
|
||||
if m.nextStream > m.maxStream {
|
||||
if !m.blockedSent {
|
||||
var streamNum uint64
|
||||
if m.maxStream != protocol.InvalidStreamID {
|
||||
m.queueStreamIDBlocked(&wire.StreamsBlockedFrame{
|
||||
Type: protocol.StreamTypeBidi,
|
||||
StreamLimit: m.maxStream.StreamNum(),
|
||||
})
|
||||
} else {
|
||||
m.queueStreamIDBlocked(&wire.StreamsBlockedFrame{
|
||||
Type: protocol.StreamTypeBidi,
|
||||
StreamLimit: 0,
|
||||
})
|
||||
streamNum = m.maxStream.StreamNum()
|
||||
}
|
||||
m.queueStreamIDBlocked(&wire.StreamsBlockedFrame{
|
||||
Type: protocol.StreamTypeBidi,
|
||||
StreamLimit: streamNum,
|
||||
})
|
||||
m.blockedSent = true
|
||||
}
|
||||
return nil, errTooManyOpenStreams
|
||||
|
|
|
@ -80,17 +80,14 @@ func (m *outgoingItemsMap) OpenStreamSync() (item, error) {
|
|||
func (m *outgoingItemsMap) openStreamImpl() (item, error) {
|
||||
if m.nextStream > m.maxStream {
|
||||
if !m.blockedSent {
|
||||
var streamNum uint64
|
||||
if m.maxStream != protocol.InvalidStreamID {
|
||||
m.queueStreamIDBlocked(&wire.StreamsBlockedFrame{
|
||||
Type: streamTypeGeneric,
|
||||
StreamLimit: m.maxStream.StreamNum(),
|
||||
})
|
||||
} else {
|
||||
m.queueStreamIDBlocked(&wire.StreamsBlockedFrame{
|
||||
Type: streamTypeGeneric,
|
||||
StreamLimit: 0,
|
||||
})
|
||||
streamNum = m.maxStream.StreamNum()
|
||||
}
|
||||
m.queueStreamIDBlocked(&wire.StreamsBlockedFrame{
|
||||
Type: streamTypeGeneric,
|
||||
StreamLimit: streamNum,
|
||||
})
|
||||
m.blockedSent = true
|
||||
}
|
||||
return nil, errTooManyOpenStreams
|
||||
|
|
|
@ -82,17 +82,14 @@ func (m *outgoingUniStreamsMap) OpenStreamSync() (sendStreamI, error) {
|
|||
func (m *outgoingUniStreamsMap) openStreamImpl() (sendStreamI, error) {
|
||||
if m.nextStream > m.maxStream {
|
||||
if !m.blockedSent {
|
||||
var streamNum uint64
|
||||
if m.maxStream != protocol.InvalidStreamID {
|
||||
m.queueStreamIDBlocked(&wire.StreamsBlockedFrame{
|
||||
Type: protocol.StreamTypeUni,
|
||||
StreamLimit: m.maxStream.StreamNum(),
|
||||
})
|
||||
} else {
|
||||
m.queueStreamIDBlocked(&wire.StreamsBlockedFrame{
|
||||
Type: protocol.StreamTypeUni,
|
||||
StreamLimit: 0,
|
||||
})
|
||||
streamNum = m.maxStream.StreamNum()
|
||||
}
|
||||
m.queueStreamIDBlocked(&wire.StreamsBlockedFrame{
|
||||
Type: protocol.StreamTypeUni,
|
||||
StreamLimit: streamNum,
|
||||
})
|
||||
m.blockedSent = true
|
||||
}
|
||||
return nil, errTooManyOpenStreams
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue