nictuku / dht

Kademlia/Mainline DHT node in Go.
Other
826 stars 144 forks source link

panic in replyAnnouncePeer #26

Closed nictuku closed 10 years ago

nictuku commented 10 years ago
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x0 pc=0x53c3eb]

goroutine 26 [running]:
runtime.panic(0x74dfe0, 0x9708b3)
        /usr/local/go/src/pkg/runtime/panic.c:279 +0xf5
github.com/nictuku/dht.(*DHT).replyAnnouncePeer(0xc208003560, 0x0, 0xc208107d88, 0x4, 0xc208107e8a, 0x1, 0xc208107d50, 0xd, 0x0, 0x0, ...)
        /home/nictuku/src/github.com/nictuku/dht/dht.go:659 +0x59b
github.com/nictuku/dht.(*DHT).processPacket(0xc208003560, 0xc2080b0000, 0xea, 0x1000, 0xc20811b408, 0x4, 0x4, 0xceba, 0x0, 0x0)
        /home/nictuku/src/github.com/nictuku/dht/dht.go:553 +0x1843
github.com/nictuku/dht.(*DHT).Run(0xc208003560, 0x0, 0x0)
        /home/nictuku/src/github.com/nictuku/dht/dht.go:385 +0xca4
created by github.com/jackpal/Taipei-Torrent/torrent.NewTorrentSession
        /home/nictuku/src/github.com/jackpal/Taipei-Torrent/torrent/torrent.go:172 +0x510

goroutine 16 [select]:
github.com/jackpal/Taipei-Torrent/torrent.RunTorrents(0xc208042680, 0xc2080040b0, 0x1, 0x1, 0x0, 0x0)
        /home/nictuku/src/github.com/jackpal/Taipei-Torrent/torrent/torrentLoop.go:67 +0xea7
main.main()
        /home/nictuku/src/github.com/jackpal/Taipei-Torrent/main.go:111 +0x737
nictuku commented 10 years ago
func (d *DHT) replyAnnouncePeer(node *remoteNode, r responseType) {
        addr := node.address     <==== PANIC HERE
        ih := InfoHash(r.A.InfoHash)
        if log.V(3) {
nictuku commented 10 years ago

I know what's happening. Sending a proper fix now.