mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-04-04 20:57:36 +03:00
continue listening after temporary errors
This commit is contained in:
parent
a65274942c
commit
b7f05b5d86
2 changed files with 14 additions and 0 deletions
|
@ -258,6 +258,10 @@ func (h *packetHandlerMap) listen() {
|
|||
defer close(h.listening)
|
||||
for {
|
||||
p, err := h.conn.ReadPacket()
|
||||
if nerr, ok := err.(net.Error); ok && nerr.Temporary() {
|
||||
h.logger.Debugf("Temporary error reading from conn: %w", err)
|
||||
continue
|
||||
}
|
||||
if err != nil {
|
||||
h.close(err)
|
||||
return
|
||||
|
|
|
@ -211,6 +211,16 @@ var _ = Describe("Packet Handler Map", func() {
|
|||
Eventually(done).Should(BeClosed())
|
||||
})
|
||||
|
||||
It("continues listening for temporary errors", func() {
|
||||
packetHandler := NewMockPacketHandler(mockCtrl)
|
||||
handler.Add(protocol.ConnectionID{1, 2, 3, 4, 5, 6, 7, 8}, packetHandler)
|
||||
err := deadlineError{}
|
||||
Expect(err.Temporary()).To(BeTrue())
|
||||
packetChan <- packetToRead{err: err}
|
||||
// don't EXPECT any calls to packetHandler.destroy
|
||||
time.Sleep(50 * time.Millisecond)
|
||||
})
|
||||
|
||||
It("says if a connection ID is already taken", func() {
|
||||
connID := protocol.ConnectionID{1, 2, 3, 4, 5, 6, 7, 8}
|
||||
Expect(handler.Add(connID, NewMockPacketHandler(mockCtrl))).To(BeTrue())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue