Loading CHANGELOG.md +1 −0 Original line number Diff line number Diff line Loading @@ -8,6 +8,7 @@ The format is based on [keep a changelog](http://keepachangelog.com) and this pr - Print a log message when all authoritative messages have stopped during graceful shutdown. - Option for read-only globals in Lua runtime to reduce memory footprint. Enabled by default. - Independent config flags for socket read and write buffer sizes. - Expose session fields in authoritative match join attempt contexts. ### Changed - Replace metrics implementation. Loading server/match_handler.go +2 −2 Original line number Diff line number Diff line Loading @@ -326,7 +326,7 @@ func (mh *MatchHandler) processDeferred() { } } func (mh *MatchHandler) QueueJoinAttempt(ctx context.Context, resultCh chan<- *MatchJoinResult, userID, sessionID uuid.UUID, username, node string, metadata map[string]string) bool { func (mh *MatchHandler) QueueJoinAttempt(ctx context.Context, resultCh chan<- *MatchJoinResult, userID, sessionID uuid.UUID, username string, sessionExpiry int64, vars map[string]string, clientIP, clientPort, node string, metadata map[string]string) bool { if mh.stopped.Load() { return false } Loading @@ -346,7 +346,7 @@ func (mh *MatchHandler) QueueJoinAttempt(ctx context.Context, resultCh chan<- *M return } state, allow, reason, err := mh.core.MatchJoinAttempt(mh.tick, mh.state, userID, sessionID, username, node, metadata) state, allow, reason, err := mh.core.MatchJoinAttempt(mh.tick, mh.state, userID, sessionID, username, sessionExpiry, vars, clientIP, clientPort, node, metadata) if err != nil { mh.Stop() resultCh <- &MatchJoinResult{Allow: false} Loading server/match_registry.go +3 −3 Original line number Diff line number Diff line Loading @@ -89,7 +89,7 @@ type MatchRegistry interface { Count() int // Pass a user join attempt to a match handler. Returns if the match was found, if the join was accepted, if it's a new user for this match, a reason for any rejection, the match label, and the list of existing match participants. JoinAttempt(ctx context.Context, id uuid.UUID, node string, userID, sessionID uuid.UUID, username, fromNode string, metadata map[string]string) (bool, bool, bool, string, string, []*MatchPresence) JoinAttempt(ctx context.Context, id uuid.UUID, node string, userID, sessionID uuid.UUID, username string, sessionExpiry int64, vars map[string]string, clientIP, clientPort, fromNode string, metadata map[string]string) (bool, bool, bool, string, string, []*MatchPresence) // Notify a match handler that one or more users have successfully joined the match. // Expects that the caller has already determined the match is hosted on the current node. Join(id uuid.UUID, presences []*MatchPresence) Loading Loading @@ -473,7 +473,7 @@ func (r *LocalMatchRegistry) Count() int { return int(r.matchCount.Load()) } func (r *LocalMatchRegistry) JoinAttempt(ctx context.Context, id uuid.UUID, node string, userID, sessionID uuid.UUID, username, fromNode string, metadata map[string]string) (bool, bool, bool, string, string, []*MatchPresence) { func (r *LocalMatchRegistry) JoinAttempt(ctx context.Context, id uuid.UUID, node string, userID, sessionID uuid.UUID, username string, sessionExpiry int64, vars map[string]string, clientIP, clientPort, fromNode string, metadata map[string]string) (bool, bool, bool, string, string, []*MatchPresence) { if node != r.node { return false, false, false, "", "", nil } Loading @@ -490,7 +490,7 @@ func (r *LocalMatchRegistry) JoinAttempt(ctx context.Context, id uuid.UUID, node } resultCh := make(chan *MatchJoinResult, 1) if !mh.QueueJoinAttempt(ctx, resultCh, userID, sessionID, username, fromNode, metadata) { if !mh.QueueJoinAttempt(ctx, resultCh, userID, sessionID, username, sessionExpiry, vars, clientIP, clientPort, fromNode, metadata) { // The match call queue was full, so will be closed and therefore can't be joined. return true, false, false, "Match is not currently accepting join requests", "", nil } Loading server/pipeline_match.go +1 −1 Original line number Diff line number Diff line Loading @@ -193,7 +193,7 @@ func (p *Pipeline) matchJoin(logger *zap.Logger, session Session, envelope *rtap // Authoritative match. mode = StreamModeMatchAuthoritative found, allow, isNew, reason, l, ps := p.matchRegistry.JoinAttempt(session.Context(), matchID, node, session.UserID(), session.ID(), username, p.node, incoming.Metadata) found, allow, isNew, reason, l, ps := p.matchRegistry.JoinAttempt(session.Context(), matchID, node, session.UserID(), session.ID(), username, session.Expiry(), session.Vars(), session.ClientIP(), session.ClientPort(), p.node, incoming.Metadata) if !found { // Match did not exist. session.Send(&rtapi.Envelope{Cid: envelope.Cid, Message: &rtapi.Envelope_Error{Error: &rtapi.Error{ Loading server/runtime.go +1 −1 Original line number Diff line number Diff line Loading @@ -236,7 +236,7 @@ func (e RuntimeExecutionMode) String() string { type RuntimeMatchCore interface { MatchInit(presenceList *MatchPresenceList, deferMessageFn RuntimeMatchDeferMessageFunction, params map[string]interface{}) (interface{}, int, error) MatchJoinAttempt(tick int64, state interface{}, userID, sessionID uuid.UUID, username, node string, metadata map[string]string) (interface{}, bool, string, error) MatchJoinAttempt(tick int64, state interface{}, userID, sessionID uuid.UUID, username string, sessionExpiry int64, vars map[string]string, clientIP, clientPort, node string, metadata map[string]string) (interface{}, bool, string, error) MatchJoin(tick int64, state interface{}, joins []*MatchPresence) (interface{}, error) MatchLeave(tick int64, state interface{}, leaves []*MatchPresence) (interface{}, error) MatchLoop(tick int64, state interface{}, inputCh <-chan *MatchDataMessage) (interface{}, error) Loading Loading
CHANGELOG.md +1 −0 Original line number Diff line number Diff line Loading @@ -8,6 +8,7 @@ The format is based on [keep a changelog](http://keepachangelog.com) and this pr - Print a log message when all authoritative messages have stopped during graceful shutdown. - Option for read-only globals in Lua runtime to reduce memory footprint. Enabled by default. - Independent config flags for socket read and write buffer sizes. - Expose session fields in authoritative match join attempt contexts. ### Changed - Replace metrics implementation. Loading
server/match_handler.go +2 −2 Original line number Diff line number Diff line Loading @@ -326,7 +326,7 @@ func (mh *MatchHandler) processDeferred() { } } func (mh *MatchHandler) QueueJoinAttempt(ctx context.Context, resultCh chan<- *MatchJoinResult, userID, sessionID uuid.UUID, username, node string, metadata map[string]string) bool { func (mh *MatchHandler) QueueJoinAttempt(ctx context.Context, resultCh chan<- *MatchJoinResult, userID, sessionID uuid.UUID, username string, sessionExpiry int64, vars map[string]string, clientIP, clientPort, node string, metadata map[string]string) bool { if mh.stopped.Load() { return false } Loading @@ -346,7 +346,7 @@ func (mh *MatchHandler) QueueJoinAttempt(ctx context.Context, resultCh chan<- *M return } state, allow, reason, err := mh.core.MatchJoinAttempt(mh.tick, mh.state, userID, sessionID, username, node, metadata) state, allow, reason, err := mh.core.MatchJoinAttempt(mh.tick, mh.state, userID, sessionID, username, sessionExpiry, vars, clientIP, clientPort, node, metadata) if err != nil { mh.Stop() resultCh <- &MatchJoinResult{Allow: false} Loading
server/match_registry.go +3 −3 Original line number Diff line number Diff line Loading @@ -89,7 +89,7 @@ type MatchRegistry interface { Count() int // Pass a user join attempt to a match handler. Returns if the match was found, if the join was accepted, if it's a new user for this match, a reason for any rejection, the match label, and the list of existing match participants. JoinAttempt(ctx context.Context, id uuid.UUID, node string, userID, sessionID uuid.UUID, username, fromNode string, metadata map[string]string) (bool, bool, bool, string, string, []*MatchPresence) JoinAttempt(ctx context.Context, id uuid.UUID, node string, userID, sessionID uuid.UUID, username string, sessionExpiry int64, vars map[string]string, clientIP, clientPort, fromNode string, metadata map[string]string) (bool, bool, bool, string, string, []*MatchPresence) // Notify a match handler that one or more users have successfully joined the match. // Expects that the caller has already determined the match is hosted on the current node. Join(id uuid.UUID, presences []*MatchPresence) Loading Loading @@ -473,7 +473,7 @@ func (r *LocalMatchRegistry) Count() int { return int(r.matchCount.Load()) } func (r *LocalMatchRegistry) JoinAttempt(ctx context.Context, id uuid.UUID, node string, userID, sessionID uuid.UUID, username, fromNode string, metadata map[string]string) (bool, bool, bool, string, string, []*MatchPresence) { func (r *LocalMatchRegistry) JoinAttempt(ctx context.Context, id uuid.UUID, node string, userID, sessionID uuid.UUID, username string, sessionExpiry int64, vars map[string]string, clientIP, clientPort, fromNode string, metadata map[string]string) (bool, bool, bool, string, string, []*MatchPresence) { if node != r.node { return false, false, false, "", "", nil } Loading @@ -490,7 +490,7 @@ func (r *LocalMatchRegistry) JoinAttempt(ctx context.Context, id uuid.UUID, node } resultCh := make(chan *MatchJoinResult, 1) if !mh.QueueJoinAttempt(ctx, resultCh, userID, sessionID, username, fromNode, metadata) { if !mh.QueueJoinAttempt(ctx, resultCh, userID, sessionID, username, sessionExpiry, vars, clientIP, clientPort, fromNode, metadata) { // The match call queue was full, so will be closed and therefore can't be joined. return true, false, false, "Match is not currently accepting join requests", "", nil } Loading
server/pipeline_match.go +1 −1 Original line number Diff line number Diff line Loading @@ -193,7 +193,7 @@ func (p *Pipeline) matchJoin(logger *zap.Logger, session Session, envelope *rtap // Authoritative match. mode = StreamModeMatchAuthoritative found, allow, isNew, reason, l, ps := p.matchRegistry.JoinAttempt(session.Context(), matchID, node, session.UserID(), session.ID(), username, p.node, incoming.Metadata) found, allow, isNew, reason, l, ps := p.matchRegistry.JoinAttempt(session.Context(), matchID, node, session.UserID(), session.ID(), username, session.Expiry(), session.Vars(), session.ClientIP(), session.ClientPort(), p.node, incoming.Metadata) if !found { // Match did not exist. session.Send(&rtapi.Envelope{Cid: envelope.Cid, Message: &rtapi.Envelope_Error{Error: &rtapi.Error{ Loading
server/runtime.go +1 −1 Original line number Diff line number Diff line Loading @@ -236,7 +236,7 @@ func (e RuntimeExecutionMode) String() string { type RuntimeMatchCore interface { MatchInit(presenceList *MatchPresenceList, deferMessageFn RuntimeMatchDeferMessageFunction, params map[string]interface{}) (interface{}, int, error) MatchJoinAttempt(tick int64, state interface{}, userID, sessionID uuid.UUID, username, node string, metadata map[string]string) (interface{}, bool, string, error) MatchJoinAttempt(tick int64, state interface{}, userID, sessionID uuid.UUID, username string, sessionExpiry int64, vars map[string]string, clientIP, clientPort, node string, metadata map[string]string) (interface{}, bool, string, error) MatchJoin(tick int64, state interface{}, joins []*MatchPresence) (interface{}, error) MatchLeave(tick int64, state interface{}, leaves []*MatchPresence) (interface{}, error) MatchLoop(tick int64, state interface{}, inputCh <-chan *MatchDataMessage) (interface{}, error) Loading