neoneo-go/pkg
Anna Shaleva 29deba45ca services: refactor test WS reader
1. Replace isFinished atomic variable with a channel, no functional changes
   here, just use more common way as all our services do.

2. Do not check erors from SetReadDeadline and ReadMessage on exit. It
   seems to be not quite right because connection is not closed by this
   moment, and thus, these error checks are racy.
3. Add read timeout for the message reader. It is needed because some
   tests may leave message unread in the end which results in hanging
   test cleanup.
4. Add drain loop to message reader in order not to block WS reader on
   sending message.

Ref. https://github.com/nspcc-dev/neo-go/pull/3392#issuecomment-2031590403.
It's clear that TestBadSubUnsub is hanging on test cleanup, in
particular, on attempt to wait for wsRead routine to exit. The only
place where wsRead routine may hang is sending to msgCh in case if
receiver is not going to read from this channel:
```
2024-04-02T08:14:51.4957621Z goroutine 14329 [chan receive]:
2024-04-02T08:14:51.4958010Z github.com/nspcc-dev/neo-go/pkg/services/rpcsrv.initCleanServerAndWSClient.func1()
2024-04-02T08:14:51.4958344Z 	D:/a/neo-go/neo-go/pkg/services/rpcsrv/subscription_test.go:80 +0x71
2024-04-02T08:14:51.4958457Z testing.(*common).Cleanup.func1()
2024-04-02T08:14:51.4958757Z 	C:/hostedtoolcache/windows/go/1.22.1/x64/src/testing/testing.go:1175 +0x17a
2024-04-02T08:14:51.4958903Z testing.(*common).runCleanup(0xc002cf5860, 0x0)
2024-04-02T08:14:51.4959193Z 	C:/hostedtoolcache/windows/go/1.22.1/x64/src/testing/testing.go:1353 +0x262
2024-04-02T08:14:51.4959291Z testing.tRunner.func2()
2024-04-02T08:14:51.4959566Z 	C:/hostedtoolcache/windows/go/1.22.1/x64/src/testing/testing.go:1683 +0x51
2024-04-02T08:14:51.4959695Z testing.tRunner(0xc002cf5860, 0x141687410)
2024-04-02T08:14:51.4959976Z 	C:/hostedtoolcache/windows/go/1.22.1/x64/src/testing/testing.go:1695 +0x25e
2024-04-02T08:14:51.4960115Z created by testing.(*T).Run in goroutine 1
2024-04-02T08:14:51.4960385Z 	C:/hostedtoolcache/windows/go/1.22.1/x64/src/testing/testing.go:1742 +0x826
```

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2024-04-03 12:56:07 +03:00
..
compiler interop: add keccak256 implementation 2024-03-22 17:15:43 +03:00
config config: update validation with check committee 2024-01-22 10:25:23 +03:00
consensus consensus: use better dbFT 2024-03-25 19:21:51 +03:00
core Merge pull request #3371 from nspcc-dev/upd-dbft 2024-03-25 19:54:05 +03:00
crypto *: use v2 LRU, fix #3322 2024-03-05 18:39:17 +03:00
encoding *: drop go 1.18 support in doc and build targets 2023-10-12 17:59:42 +03:00
interop interop: add keccak256 implementation 2024-03-22 17:15:43 +03:00
io *: replace interface{} with any keyword 2023-04-04 13:22:42 +03:00
neorpc neorpc: add WS notification filter IsValid functionality 2023-12-28 11:08:46 +03:00
neotest neotest: reuse wallet.Account for contract signers 2023-12-21 11:27:41 +03:00
network network: fix logging data race in the package 2024-03-20 13:12:14 +03:00
rpcclient *: adjust WS connection RW deadlines 2024-04-02 10:31:38 +03:00
services services: refactor test WS reader 2024-04-03 12:56:07 +03:00
smartcontract go.mod: upgrade minimum required Go version to 1.20 2024-03-05 13:54:10 +03:00
util *: replace slice.Copy with bytes.Clone 2024-03-05 13:54:10 +03:00
vm *: improve error text for System.Crypto.CheckMultisig handling 2024-03-25 19:16:21 +03:00
wallet *: regenerate all wallets with adjusted parameters 2024-03-01 19:19:03 +03:00