Send the correct room closed reason to clients (#2901)

* Send the correct room closed reason to clients

* update go mod
This commit is contained in:
David Zhao
2024-08-01 19:40:06 -07:00
committed by GitHub
parent 1993c87fd8
commit b1fbca066f
4 changed files with 18 additions and 13 deletions
+1 -1
View File
@@ -791,7 +791,7 @@ func (r *Room) CloseIfEmpty() {
r.lock.Unlock()
if elapsed >= int64(timeout) {
r.Close(types.ParticipantCloseReasonNone)
r.Close(types.ParticipantCloseReasonRoomClosed)
}
}
+5
View File
@@ -106,6 +106,7 @@ const (
ParticipantCloseReasonDataChannelError
ParticipantCloseReasonMigrateCodecMismatch
ParticipantCloseReasonSignalSourceClose
ParticipantCloseReasonRoomClosed
)
func (p ParticipantCloseReason) String() string {
@@ -158,6 +159,8 @@ func (p ParticipantCloseReason) String() string {
return "MIGRATE_CODEC_MISMATCH"
case ParticipantCloseReasonSignalSourceClose:
return "SIGNAL_SOURCE_CLOSE"
case ParticipantCloseReasonRoomClosed:
return "ROOM_CLOSED"
default:
return fmt.Sprintf("%d", int(p))
}
@@ -188,6 +191,8 @@ func (p ParticipantCloseReason) ToDisconnectReason() livekit.DisconnectReason {
return livekit.DisconnectReason_STATE_MISMATCH
case ParticipantCloseReasonSignalSourceClose:
return livekit.DisconnectReason_SIGNAL_CLOSE
case ParticipantCloseReasonRoomClosed:
return livekit.DisconnectReason_ROOM_CLOSED
default:
// the other types will map to unknown reason
return livekit.DisconnectReason_UNKNOWN_REASON