mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-04-05 13:17:36 +03:00
dequeue all 0-RTT packets to the session in one go
This commit is contained in:
parent
d1c5297c0b
commit
7a301aae3d
3 changed files with 47 additions and 45 deletions
|
@ -45,21 +45,23 @@ func (h *zeroRTTQueue) Enqueue(connID protocol.ConnectionID, p *receivedPacket)
|
|||
entry.packets = append(entry.packets, p)
|
||||
}
|
||||
|
||||
func (h *zeroRTTQueue) Dequeue(connID protocol.ConnectionID) *receivedPacket {
|
||||
func (h *zeroRTTQueue) DequeueToSession(connID protocol.ConnectionID, sess packetHandler) {
|
||||
h.mutex.Lock()
|
||||
defer h.mutex.Unlock()
|
||||
|
||||
h.dequeueToSession(connID, sess)
|
||||
}
|
||||
|
||||
func (h *zeroRTTQueue) dequeueToSession(connID protocol.ConnectionID, sess packetHandler) {
|
||||
entry, ok := h.queue[string(connID)]
|
||||
if !ok {
|
||||
return nil
|
||||
return
|
||||
}
|
||||
p := entry.packets[0]
|
||||
entry.packets = entry.packets[1:]
|
||||
if len(entry.packets) == 0 {
|
||||
entry.timer.Stop()
|
||||
delete(h.queue, string(connID))
|
||||
entry.timer.Stop()
|
||||
for _, p := range entry.packets {
|
||||
sess.handlePacket(p)
|
||||
}
|
||||
return p
|
||||
delete(h.queue, string(connID))
|
||||
}
|
||||
|
||||
func (h *zeroRTTQueue) deleteQueue(connID protocol.ConnectionID) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue