neoneo-go/pkg/network
Roman Khimov 31948ee4a7 network: add a nil check in (*TCPTransport).Close, prevent panic
You have to try to trigger that, but in the event of server shutdown before it
actually started listening Close will easily panic like this:

2020-03-05T11:48:08.660+0300    INFO    node started    {"blockHeight": 6458, "headerHeight": 15605}
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x28 pc=0x9d5f0a]

goroutine 1 [running]:
github.com/nspcc-dev/neo-go/pkg/network.(*TCPTransport).Close(0xc000fd7050)
        /home/rik/dev/neo-go/pkg/network/tcp_transport.go:78 +0x2a
github.com/nspcc-dev/neo-go/pkg/network.(*Server).Shutdown(0xc000182280)
        /home/rik/dev/neo-go/pkg/network/server.go:190 +0x189
github.com/nspcc-dev/neo-go/cli/server.startServer(0xc000200160, 0x0, 0x0)
        /home/rik/dev/neo-go/cli/server/server.go:367 +0x79e
github.com/urfave/cli.HandleAction(0xb84860, 0xccf240, 0xc000200160, 0xc0001c4500, 0x0)
        /home/rik/dev/neo-go/vendor/github.com/urfave/cli/app.go:490 +0xc8
github.com/urfave/cli.Command.Run(0xc9a160, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0xca407f, 0x10, 0x0, ...)
        /home/rik/dev/neo-go/vendor/github.com/urfave/cli/command.go:210 +0x996
github.com/urfave/cli.(*App).Run(0xc0001d64e0, 0xc0000ca000, 0x3, 0x3, 0x0, 0x0)
        /home/rik/dev/neo-go/vendor/github.com/urfave/cli/app.go:255 +0x6af
main.main()
        /home/rik/dev/neo-go/cli/main.go:25 +0x505
2020-03-05 11:53:26 +03:00
..
metrics cli,pkg: use zap.Logger 2020-01-10 11:14:27 +03:00
payload *: move all packages from CityOfZion to nspcc-dev 2020-03-03 17:21:42 +03:00
blockqueue.go *: move all packages from CityOfZion to nspcc-dev 2020-03-03 17:21:42 +03:00
blockqueue_test.go *: move all packages from CityOfZion to nspcc-dev 2020-03-03 17:21:42 +03:00
discovery.go network: add Close() to discoverer, shut it down on exit 2020-02-28 16:22:04 +03:00
discovery_test.go network: add Close() to discoverer, shut it down on exit 2020-02-28 16:22:04 +03:00
helper_test.go *: move all packages from CityOfZion to nspcc-dev 2020-03-03 17:21:42 +03:00
message.go *: move all packages from CityOfZion to nspcc-dev 2020-03-03 17:21:42 +03:00
message_test.go Node improvements (#47) 2018-03-14 10:36:59 +01:00
peer.go *: move all packages from CityOfZion to nspcc-dev 2020-03-03 17:21:42 +03:00
prometheus.go monitoring: add prometheus monitoring 2019-10-29 20:51:17 +03:00
relay_reason.go fix spelling and godoc comments 2019-10-22 17:56:03 +03:00
server.go *: move all packages from CityOfZion to nspcc-dev 2020-03-03 17:21:42 +03:00
server_config.go *: move all packages from CityOfZion to nspcc-dev 2020-03-03 17:21:42 +03:00
server_test.go *: move all packages from CityOfZion to nspcc-dev 2020-03-03 17:21:42 +03:00
tcp_peer.go *: move all packages from CityOfZion to nspcc-dev 2020-03-03 17:21:42 +03:00
tcp_peer_test.go *: move all packages from CityOfZion to nspcc-dev 2020-03-03 17:21:42 +03:00
tcp_transport.go network: add a nil check in (*TCPTransport).Close, prevent panic 2020-03-05 11:53:26 +03:00
transport.go Fixed some networking issues (#68) 2018-04-13 12:14:08 +02:00