]> Sergey Matveev's repositories - btrtrc.git/commitdiff
tracker/udp: Panic on read errors if ConnClient not closed
authorMatt Joiner <anacrolix@gmail.com>
Mon, 22 Nov 2021 21:35:45 +0000 (08:35 +1100)
committerMatt Joiner <anacrolix@gmail.com>
Mon, 22 Nov 2021 21:35:45 +0000 (08:35 +1100)
There's nothing exposed to handle this error currently, and if it occurs, it's better not to fail in silence. I'm currently debugging a situation where ConnClients stop working, this would be a condition we'd want to know about.

tracker/udp/conn-client.go

index 4e0d9852bd2672f9732eb88296396c7707ed5f60..1958c65953359558fd18dff4bddbbd9ed0155b62 100644 (file)
@@ -35,6 +35,9 @@ func (cc *ConnClient) reader() {
                        // TODO: Do bad things to the dispatcher, and incoming calls to the client if we have a
                        // read error.
                        cc.readErr = err
+                       if !cc.closed {
+                               panic(err)
+                       }
                        break
                }
                err = cc.d.Dispatch(b[:n], addr)