mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-04-04 20:57:36 +03:00
reduce the size of messageChan channel in the crypto setup (#3664)
This commit is contained in:
parent
04c3fd0756
commit
0ac5d1c149
1 changed files with 9 additions and 2 deletions
|
@ -263,7 +263,7 @@ func newCryptoSetup(
|
||||||
alertChan: make(chan uint8),
|
alertChan: make(chan uint8),
|
||||||
clientHelloWrittenChan: make(chan struct{}),
|
clientHelloWrittenChan: make(chan struct{}),
|
||||||
zeroRTTParametersChan: zeroRTTParametersChan,
|
zeroRTTParametersChan: zeroRTTParametersChan,
|
||||||
messageChan: make(chan []byte, 100),
|
messageChan: make(chan []byte, 1),
|
||||||
isReadingHandshakeMessage: make(chan struct{}),
|
isReadingHandshakeMessage: make(chan struct{}),
|
||||||
closeChan: make(chan struct{}),
|
closeChan: make(chan struct{}),
|
||||||
version: version,
|
version: version,
|
||||||
|
@ -368,8 +368,15 @@ func (h *cryptoSetup) HandleMessage(data []byte, encLevel protocol.EncryptionLev
|
||||||
h.onError(alertUnexpectedMessage, err.Error())
|
h.onError(alertUnexpectedMessage, err.Error())
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
h.messageChan <- data
|
if encLevel != protocol.Encryption1RTT {
|
||||||
|
select {
|
||||||
|
case h.messageChan <- data:
|
||||||
|
case <-h.handshakeDone: // handshake errored, nobody is going to consume this message
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
if encLevel == protocol.Encryption1RTT {
|
if encLevel == protocol.Encryption1RTT {
|
||||||
|
h.messageChan <- data
|
||||||
h.handlePostHandshakeMessage()
|
h.handlePostHandshakeMessage()
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue