]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Avoid deadlock caused by receiving PORT and and DHT announce_peer at the same time
authorMatt Joiner <anacrolix@gmail.com>
Sun, 27 Nov 2016 13:03:10 +0000 (00:03 +1100)
committerMatt Joiner <anacrolix@gmail.com>
Sun, 27 Nov 2016 13:03:10 +0000 (00:03 +1100)
connection.go
dht/server.go

index 1d67e9dc197c98c323333155839bd88b1019f9c9..60ebb2326595ecde988052a76265e6a294130fa3 100644 (file)
@@ -902,7 +902,7 @@ func (c *connection) mainReadLoop() error {
                        if msg.Port != 0 {
                                pingAddr.Port = int(msg.Port)
                        }
-                       cl.dHT.Ping(pingAddr)
+                       go cl.dHT.Ping(pingAddr)
                default:
                        err = fmt.Errorf("received unknown message type: %#v", msg.Type)
                }
index 74b56cf68964b68a7bab0afc588b50b5a3a293a7..7e9109791091b7b7843df3fe2f00aedb9f47bf45 100644 (file)
@@ -331,7 +331,7 @@ func (s *Server) handleQuery(source Addr, m krpc.Msg) {
                        if args.ImpliedPort != 0 {
                                p.Port = source.UDPAddr().Port
                        }
-                       h(ih, p)
+                       go h(ih, p)
                }
        case "vote":
                // TODO(anacrolix): Or reject, I don't think I want this.