mirror of
https://github.com/tiennm99/noitu.git
synced 2026-10-17 06:15:16 +00:00
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:
1 parent
865222d2cd
commit
4a78b8aad5
7 files changed
+342
No files matched your search
@@ -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{}}})
|
||||
|
||||
Reference in new issue
Block a user