fix availability signaling of the send queue (#3597)

This commit is contained in:
Marten Seemann
2022-10-22 12:09:40 +01:00
committed by GitHub
parent e496120c76
commit af30cef57c
2 changed files with 49 additions and 0 deletions

View File

@@ -36,6 +36,13 @@ func newSendQueue(conn sendConn) sender {
func (h *sendQueue) Send(p *packetBuffer) {
select {
case h.queue <- p:
// clear available channel if we've reached capacity
if len(h.queue) == sendQueueCapacity {
select {
case <-h.available:
default:
}
}
case <-h.runStopped:
default:
panic("sendQueue.Send would have blocked")