rpc: add subscriber queue overflow check

Server-side test is added, but disabled because of its unreliability.
This commit is contained in:
Roman Khimov 2020-05-12 22:38:29 +03:00
parent 44ae9086b6
commit c4c080d240
6 changed files with 111 additions and 21 deletions

View file

@ -3,14 +3,15 @@ package server
import (
"github.com/gorilla/websocket"
"github.com/nspcc-dev/neo-go/pkg/rpc/response"
"go.uber.org/atomic"
)
type (
// subscriber is an event subscriber.
subscriber struct {
writer chan<- *websocket.PreparedMessage
ws *websocket.Conn
writer chan<- *websocket.PreparedMessage
ws *websocket.Conn
overflown atomic.Bool
// These work like slots as there is not a lot of them (it's
// cheaper doing it this way rather than creating a map),
// pointing to EventID is an obvious overkill at the moment, but