diff --git a/go.mod b/go.mod index 0a6a22e92..55bdf34be 100644 --- a/go.mod +++ b/go.mod @@ -18,7 +18,7 @@ require ( github.com/jxskiss/base62 v1.1.0 github.com/livekit/mageutil v0.0.0-20230125210925-54e8a70427c1 github.com/livekit/mediatransportutil v0.0.0-20230326055817-ed569ca13d26 - github.com/livekit/protocol v1.5.2-0.20230405103303-8c8b87686b2c + github.com/livekit/protocol v1.5.2-0.20230405195605-927c9ea2b4c6 github.com/livekit/psrpc v0.2.11-0.20230405191830-d76f71512630 github.com/mackerelio/go-osstat v0.2.4 github.com/magefile/mage v1.14.0 diff --git a/go.sum b/go.sum index a63672866..c963460f4 100644 --- a/go.sum +++ b/go.sum @@ -235,8 +235,8 @@ github.com/livekit/mageutil v0.0.0-20230125210925-54e8a70427c1 h1:jm09419p0lqTkD github.com/livekit/mageutil v0.0.0-20230125210925-54e8a70427c1/go.mod h1:Rs3MhFwutWhGwmY1VQsygw28z5bWcnEYmS1OG9OxjOQ= github.com/livekit/mediatransportutil v0.0.0-20230326055817-ed569ca13d26 h1:QlQFyMwCDgjyySsrgmrMcVbEBA6KZcyTzvK+z346tUA= github.com/livekit/mediatransportutil v0.0.0-20230326055817-ed569ca13d26/go.mod h1:eDA41kiySZoG+wy4Etsjb3w0jjLx69i/vAmSjG4bteA= -github.com/livekit/protocol v1.5.2-0.20230405103303-8c8b87686b2c h1:fkBV/qBvTSZogAh+dJ75WYqrAGHOpNGIi7Z1iuulHMQ= -github.com/livekit/protocol v1.5.2-0.20230405103303-8c8b87686b2c/go.mod h1:UFgAWejoO4eshaaDe2jynTdQWwSktNO+8Wx19V7bs+o= +github.com/livekit/protocol v1.5.2-0.20230405195605-927c9ea2b4c6 h1:rvkmoc5s+VJTpShWkY+QWFQ5XhLDMFFyZIZrrr7PgJE= +github.com/livekit/protocol v1.5.2-0.20230405195605-927c9ea2b4c6/go.mod h1:UFgAWejoO4eshaaDe2jynTdQWwSktNO+8Wx19V7bs+o= github.com/livekit/psrpc v0.2.11-0.20230405191830-d76f71512630 h1:Rm5KLZgQxWnTidY+H8MsAV6sk1iiFxeXqPFgSLkMing= github.com/livekit/psrpc v0.2.11-0.20230405191830-d76f71512630/go.mod h1:K0j8f1PgLShR7Lx80KbmwFkDH2BvOnycXGV0OSRURKc= github.com/mackerelio/go-osstat v0.2.4 h1:qxGbdPkFo65PXOb/F/nhDKpF2nGmGaCFDLXoZjJTtUs= diff --git a/pkg/routing/redisrouter.go b/pkg/routing/redisrouter.go index be1a8e025..d53c52997 100644 --- a/pkg/routing/redisrouter.go +++ b/pkg/routing/redisrouter.go @@ -149,10 +149,6 @@ func (r *RedisRouter) StartParticipantSignal(ctx context.Context, roomName livek return } - if r.usePSRPCSignal { - return r.StartParticipantSignalWithNodeID(ctx, roomName, pi, livekit.NodeID(rtcNode.Id)) - } - // create a new connection id connectionID = livekit.ConnectionID(utils.NewGuid("CO_")) pKey := participantKeyLegacy(roomName, pi.Identity) @@ -163,6 +159,10 @@ func (r *RedisRouter) StartParticipantSignal(ctx context.Context, roomName livek return } + if r.usePSRPCSignal { + return r.StartParticipantSignalWithNodeID(ctx, roomName, pi, livekit.NodeID(rtcNode.Id)) + } + // index by connectionID, since there may be multiple connections for the participant // set up response channel before sending StartSession and be ready to receive responses. resChan := r.getOrCreateMessageChannel(r.responseChannels, string(connectionID)) diff --git a/pkg/routing/signal.go b/pkg/routing/signal.go index 1bfe7b365..418852c3d 100644 --- a/pkg/routing/signal.go +++ b/pkg/routing/signal.go @@ -105,6 +105,11 @@ func (r *signalClient) StartParticipantSignal( if err = resChan.WriteMessage(msg.Response); err != nil { break } + for _, res := range msg.Responses { + if err = resChan.WriteMessage(res); err != nil { + break + } + } } logger.Debugw("participant signal stream closed",