ethresearch / sharding-p2p-poc

Proof of Concept of Ethereum Serenity Peer-to-Peer Layer on libp2p PubSub System
40 stars 19 forks source link

Check `closer != nil` before `defer closer.Close()` #90

Closed mhchia closed 5 years ago

mhchia commented 5 years ago

What was wrong?

SIGSEGV occurs when tracer is not Newed successfully and therefore closer == nil

[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x16135cd]

goroutine 1 [running]:
main.runServer(0x17d3d9d, 0x9, 0x2710, 0x0, 0x0, 0x0, 0x0, 0xc4200b3e10, 0xf, 0xc4200b3e30, ...)
        /go/src/github.com/ethresearch/sharding-p2p-poc/main.go:160 +0x67d
main.main()
        /go/src/github.com/ethresearch/sharding-p2p-poc/main.go:81 +0x5b0

How was it fixed?

Move defer closer.Close() to the else block

Cute Animal Picture

put a cute animal picture link inside the parentheses