feat(server): pair strangers with quick-match

The hub keeps a FIFO of waiting sessions; a second QuickMatch pops the
first, opens a room via the existing createInput/joinInput path, and
marks it to begin its own first game once both seats are connected in
the lobby. CancelQuickMatch, a dropped connection, and entering a room
by code all remove a session from the queue. Counts queued, cancelled
and matched pairings in metrics.
This commit is contained in:
tiennm99 committed 2026-09-21 01:39:44 +07:00
1 parent 865222d2cd
commit 4a78b8aad5
7 files changed
+342

No files matched your search

+14
View File
@@ -277,6 +277,8 @@ func payloadCase(m *noituv1.ServerMessage) string {
return "chat_message"
case *noituv1.ServerMessage_ChatHistory:
return "chat_history"
case *noituv1.ServerMessage_QuickMatchStatus:
return "quick_match_status"
}
// Named rather than empty: a missing arm here makes every await for that
// message time out with nothing to say about why.
@@ -1151,6 +1153,18 @@ func (c *testClient) leaveRoom() {
c.send(&noituv1.ClientMessage{Payload: &noituv1.ClientMessage_LeaveRoom{LeaveRoom: &noituv1.LeaveRoom{}}})
}
func (c *testClient) quickMatch() {
c.t.Helper()
c.send(&noituv1.ClientMessage{Payload: &noituv1.ClientMessage_QuickMatch{QuickMatch: &noituv1.QuickMatch{}}})
}
func (c *testClient) cancelQuickMatch() {
c.t.Helper()
c.send(&noituv1.ClientMessage{
Payload: &noituv1.ClientMessage_CancelQuickMatch{CancelQuickMatch: &noituv1.CancelQuickMatch{}},
})
}
func (c *testClient) resign() {
c.t.Helper()
c.send(&noituv1.ClientMessage{Payload: &noituv1.ClientMessage_Resign{Resign: &noituv1.Resign{}}})