neoneo-go/pkg/network
Ekaterina Pavlova 775c56e87e network: ensure server is started and shut down only once
Use started atomic.Bool field to ensure that the node server shutdown
procedure is executed only once. Prevent the following panic caused by
server double-shutdown in testing code:
```
--- FAIL: TestServerRegisterPeer (0
.06s)
 panic: closed twice
 goroutine 60 [running]:
 testing.tRunner.func1.2({0x104c40b20, 0x104d0ec90})
 	/opt/homebrew/opt/go/libexec/src/testing/testing.go:1545 +0x1c8
 testing.tRunner.func1()
 	/opt/homebrew/opt/go/libexec/src/testing/testing.go:1548 +0x360
 panic({0x104c40b20?, 0x104d0ec90?})
 	/opt/homebrew/opt/go/libexec/src/runtime/panic.go:914 +0x218
 github.com/nspcc-dev/neo-go/pkg/network.(*fakeTransp).Close
 (0x14000159e08?)
 	/Users/ekaterinapavlova/Workplace/neo-go/pkg/network
 	/discovery_test.go:83 +0x54
 github.com/nspcc-dev/neo-go/pkg/network.(*Server).Shutdown
 (0x14000343400)
 	/Users/ekaterinapavlova/Workplace/neo-go/pkg/network/server.go:299
 	 +0x104
 github.com/nspcc-dev/neo-go/pkg/network.startWithCleanup.func1()
 	/Users/ekaterinapavlova/Workplace/neo-go/pkg/network/server_test
 	.go:408 +0x20
 testing.(*common).Cleanup.func1()
 	/opt/homebrew/opt/go/libexec/src/testing/testing.go:1169 +0x110
 testing.(*common).runCleanup(0x1400032c340, 0x14000159d80?)
 	/opt/homebrew/opt/go/libexec/src/testing/testing.go:1347 +0xd8
 testing.tRunner.func2()
 	/opt/homebrew/opt/go/libexec/src/testing/testing.go:1589 +0x2c
 testing.tRunner(0x1400032c340, 0x104d0c5d0)
 	/opt/homebrew/opt/go/libexec/src/testing/testing.go:1601 +0x114
 created by testing.(*T).Run in goroutine 1
 	/opt/homebrew/opt/go/libexec/src/testing/testing.go:1648 +0x33c
```

Signed-off-by: Ekaterina Pavlova <ekt@morphbits.io>
2024-02-27 15:10:51 +03:00
..
bqueue *: replace go.uber.org/atomic with sync/atomic 2023-10-12 17:59:34 +03:00
capability [#2442] English Check 2022-05-04 19:48:27 +03:00
extpool *: use require.ErrorIs instead of require.True(t, error.Is()) 2023-05-04 17:03:47 +03:00
payload Merge pull request #3171 from nspcc-dev/fix-linter 2023-10-20 21:14:41 +03:00
compress.go network: check compressed payload size in decompress 2022-03-24 17:22:55 +03:00
discovery.go network: add random slight delay to connection attempts 2022-11-17 18:42:43 +03:00
discovery_test.go *: replace go.uber.org/atomic with sync/atomic 2023-10-12 17:59:34 +03:00
fuzz_test.go *: drop go 1.18 support in doc and build targets 2023-10-12 17:59:42 +03:00
helper_test.go config: add a special Blockchain type to configure Blockchain 2022-12-07 17:35:53 +03:00
message.go golangci: enable errorlint and fix everything it found 2022-09-02 18:36:23 +03:00
message_string.go *: update Stringers wrt fresh Stringer version 2023-10-19 11:33:07 +03:00
message_test.go network: check compressed payload size in decompress 2022-03-24 17:22:55 +03:00
notary_feer.go *: move NVB and Conflicts attributes out of extensions 2023-09-04 16:39:44 +03:00
peer.go network: rework discoverer/server interaction 2022-11-17 17:07:19 +03:00
prometheus.go network: add neogo_version metric, deprecate serv_node_version 2023-05-11 13:48:38 +03:00
server.go network: ensure server is started and shut down only once 2024-02-27 15:10:51 +03:00
server_config.go config: drop deprecated P2P configuration 2023-10-10 13:26:07 +03:00
server_test.go network: ensure server is started and shut down only once 2024-02-27 15:10:51 +03:00
state_sync.go network: move blockqueue to a separate package 2023-03-15 17:37:47 +03:00
tcp_peer.go tcp_peer: Fix possible goroutine leak 2024-02-25 22:38:18 +03:00
tcp_peer_test.go ci: fix lint issues (fix #2948) 2023-03-29 11:19:23 +08:00
tcp_transport.go *: use zap.Stringer instead of zap.String where it can be used 2022-12-13 12:44:54 +03:00
transport.go network: allow multiple bind addresses for server 2022-12-07 13:06:03 +03:00