Skip to content

Commit

Permalink
Also change the joining logic a bit in case of a failure.
Browse files Browse the repository at this point in the history
  • Loading branch information
koenbollen committed Sep 6, 2023
1 parent 7832dec commit e56fd50
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions internal/signaling/peer.go
Original file line number Diff line number Diff line change
Expand Up @@ -380,15 +380,14 @@ func (p *Peer) HandleJoinPacket(ctx context.Context, packet JoinPacket) error {
return fmt.Errorf("lobby code too long")
}

p.Lobby = packet.Lobby

p.store.Subscribe(ctx, p.Game+p.Lobby+p.ID, p.ForwardMessage)

others, err := p.store.JoinLobby(ctx, p.Game, p.Lobby, p.ID)
others, err := p.store.JoinLobby(ctx, p.Game, packet.Lobby, p.ID)
if err != nil {
return err
}

p.Lobby = packet.Lobby
p.store.Subscribe(ctx, p.Game+p.Lobby+p.ID, p.ForwardMessage)

err = p.Send(ctx, JoinedPacket{
RequestID: packet.RequestID,
Type: "joined",
Expand Down

0 comments on commit e56fd50

Please sign in to comment.