From 26700ea1352adecd4c9d3c358ec018b772c2aff6 Mon Sep 17 00:00:00 2001 From: David Zhao <320582+davidzhao@users.noreply.github.com> Date: Sun, 24 Apr 2022 09:07:33 -0700 Subject: [PATCH] Add back region when hydrating ParticipantInit. (#648) It was left out in the previous PR #646 --- pkg/routing/interfaces.go | 3 ++- pkg/routing/redisrouter.go | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/routing/interfaces.go b/pkg/routing/interfaces.go index fc7da59bc..9cac114af 100644 --- a/pkg/routing/interfaces.go +++ b/pkg/routing/interfaces.go @@ -122,7 +122,7 @@ func (pi *ParticipantInit) ToStartSession(roomName livekit.RoomName, connectionI }, nil } -func ParticipantInitFromStartSession(ss *livekit.StartSession) (*ParticipantInit, error) { +func ParticipantInitFromStartSession(ss *livekit.StartSession, region string) (*ParticipantInit, error) { claims := &auth.ClaimGrants{} if err := json.Unmarshal([]byte(ss.GrantsJson), claims); err != nil { return nil, err @@ -135,6 +135,7 @@ func ParticipantInitFromStartSession(ss *livekit.StartSession) (*ParticipantInit Client: ss.Client, AutoSubscribe: ss.AutoSubscribe, Grants: claims, + Region: region, AdaptiveStream: ss.AdaptiveStream, }, nil } diff --git a/pkg/routing/redisrouter.go b/pkg/routing/redisrouter.go index c0eee1dc2..c15fd6718 100644 --- a/pkg/routing/redisrouter.go +++ b/pkg/routing/redisrouter.go @@ -240,7 +240,7 @@ func (r *RedisRouter) startParticipantRTC(ss *livekit.StartSession, participantK } } - pi, err := ParticipantInitFromStartSession(ss) + pi, err := ParticipantInitFromStartSession(ss, r.currentNode.Region) if err != nil { return err }