send leave when client reconnects on server restart (#43)

This commit is contained in:
David Colburn authored and GitHub committed 2021-07-08 01:37:21 -05:00
1 parent ec2d7a49cd
commit 145f058eaa
3 files changed
+16 -3

No files matched your search

+1 -1
View File
@@ -10,7 +10,7 @@ require (
github.com/google/wire v0.5.0
github.com/gorilla/websocket v1.4.2
github.com/jxskiss/base62 v0.0.0-20191017122030-4f11678b909b
github.com/livekit/protocol v0.5.5
github.com/livekit/protocol v0.5.6
github.com/magefile/mage v1.11.0
github.com/maxbrunsfeld/counterfeiter/v6 v6.3.0
github.com/mitchellh/go-homedir v1.1.0
+2 -2
View File
@@ -232,8 +232,8 @@ github.com/lithammer/shortuuid/v3 v3.0.6 h1:pr15YQyvhiSX/qPxncFtqk+v4xLEpOZObbsY
github.com/lithammer/shortuuid/v3 v3.0.6/go.mod h1:vMk8ke37EmiewwolSO1NLW8vP4ZaKlRuDIi8tWWmAts=
github.com/livekit/ion-sfu v1.10.7-0.20210706220057-6c0f6eb24d59 h1:xltblvdgh94JRNnCM9z/cwVq9Dqh//l9SjxOlfFa1XQ=
github.com/livekit/ion-sfu v1.10.7-0.20210706220057-6c0f6eb24d59/go.mod h1:Wx6b4qGUjvSo1kGl+/fHl0ZF48g2IJOjzUFg0yCo9qY=
github.com/livekit/protocol v0.5.5 h1:ZsfmTpaApf2o75qpJLP2f/FsCOwxW2sDJE3HKDa2OXE=
github.com/livekit/protocol v0.5.5/go.mod h1:wo3CGfYB7XMF8GoVJAfTARrYSP/ombi+sbLl6AYdKP0=
github.com/livekit/protocol v0.5.6 h1:vMUjYvJH2TD/WIjrXtG6aQl5fFrIj0/ZgIctQqmmwro=
github.com/livekit/protocol v0.5.6/go.mod h1:wo3CGfYB7XMF8GoVJAfTARrYSP/ombi+sbLl6AYdKP0=
github.com/lucsky/cuid v1.0.2 h1:z4XlExeoderxoPj2/dxKOyPxe9RCOu7yNq9/XWxIUMQ=
github.com/lucsky/cuid v1.0.2/go.mod h1:QaaJqckboimOmhRSJXSx/+IT+VTfxfPGSo/6mfgUfmE=
github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ=
+13
View File
@@ -245,6 +245,19 @@ func (r *RoomManager) StartSession(roomName string, pi routing.ParticipantInit,
// we need to clean up the existing participant, so a new one can join
room.RemoveParticipant(participant.Identity())
}
} else if pi.Reconnect {
// send leave request if participant is trying to reconnect but missing from the room
if err = responseSink.WriteMessage(&livekit.SignalRequest{
Message: &livekit.SignalRequest_Leave{
Leave: &livekit.LeaveRequest{
CanReconnect: true,
},
},
}); err != nil {
logger.Warnw("could not restart participant", err,
"participant", pi.Identity)
}
return
}
logger.Debugw("starting RTC session",