Добавление и обработка событий Peer_disconnected и Room_Delete
This commit is contained in:
@@ -144,6 +144,7 @@ func JoinWithOffer(roomID string, peerID string, offer webrtc.SessionDescription
|
||||
func DeleteRoom(roomID string) error {
|
||||
roomsMu.Lock()
|
||||
room, exists := rooms[roomID]
|
||||
server := room.Server
|
||||
if !exists {
|
||||
roomsMu.Unlock()
|
||||
return ErrRoomNotFound
|
||||
@@ -163,6 +164,8 @@ func DeleteRoom(roomID string) error {
|
||||
cleanupForwardingState(roomID, p.PeerID)
|
||||
}
|
||||
|
||||
OnRoomDelete(roomID, server)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -218,7 +221,7 @@ func LeaveRoom(roomID string, peerID string) error {
|
||||
return DeleteRoom(roomID)
|
||||
}
|
||||
|
||||
// Опционально: renegotiation оставшимся peer после удаления треков/peer
|
||||
// renegotiation оставшимся peer после удаления треков/peer
|
||||
room.mu.RLock()
|
||||
rest := make([]Peer, len(room.Peers))
|
||||
copy(rest, room.Peers)
|
||||
|
||||
Reference in New Issue
Block a user