make server a bit more resiliant
This commit is contained in:
parent
6f91491127
commit
58a853a241
@ -57,12 +57,24 @@ func (c *Coordinator) Coordinate(cmd *SessionCommand) *SessionCommandResult {
|
|||||||
Result: SessionRespFound,
|
Result: SessionRespFound,
|
||||||
}
|
}
|
||||||
case SessionCmdJoin:
|
case SessionCmdJoin:
|
||||||
|
if c.Match == nil {
|
||||||
|
return &SessionCommandResult{
|
||||||
|
ID: cmd.ID,
|
||||||
|
Result: SessionRespJoinError,
|
||||||
|
}
|
||||||
|
}
|
||||||
resp := c.Match.Join(cmd.ID)
|
resp := c.Match.Join(cmd.ID)
|
||||||
return &SessionCommandResult{
|
return &SessionCommandResult{
|
||||||
ID: cmd.ID,
|
ID: cmd.ID,
|
||||||
Result: resp,
|
Result: resp,
|
||||||
}
|
}
|
||||||
case SessionCmdLeave:
|
case SessionCmdLeave:
|
||||||
|
if c.Match == nil {
|
||||||
|
return &SessionCommandResult{
|
||||||
|
ID: cmd.ID,
|
||||||
|
Result: SessionRespLeft,
|
||||||
|
}
|
||||||
|
}
|
||||||
c.Match.Leave(cmd.ID)
|
c.Match.Leave(cmd.ID)
|
||||||
return &SessionCommandResult{
|
return &SessionCommandResult{
|
||||||
ID: cmd.ID,
|
ID: cmd.ID,
|
||||||
|
Loading…
Reference in New Issue
Block a user