【m】开发完成
This commit is contained in:
@@ -395,7 +395,9 @@ namespace Unity.RenderStreaming
|
||||
peer.OnConnectHandler += () => onConnect?.Invoke(connectionId);
|
||||
peer.OnDisconnectHandler += () =>
|
||||
{
|
||||
_signaling?.CloseConnection(connectionId);
|
||||
// PeerConnection失败时不自动发送disconnect,避免重复断开通知。
|
||||
// 主动断开由 Handler 的 DeleteConnection 触发,远端断开由服务器的 disconnect 消息触发。
|
||||
// 这里只触发 onDisconnect 事件通知 Handler 进行资源清理。
|
||||
onDisconnect?.Invoke(connectionId);
|
||||
};
|
||||
peer.OnDataChannelHandler += channel => onAddChannel?.Invoke(connectionId, channel); ;
|
||||
@@ -473,10 +475,11 @@ namespace Unity.RenderStreaming
|
||||
|
||||
void OnParticipantLeftHandler(ISignaling signaling, ParticipantEventData e)
|
||||
{
|
||||
// 参与者离开时,销毁对应的PeerConnection
|
||||
// 参与者离开时,只销毁对应的PeerConnection,不触发onDeletedConnection事件
|
||||
// 因为onParticipantLeft已经会通知Handler进行资源清理,避免重复通知
|
||||
if (_mapConnectionIdAndPeer.ContainsKey(e.participantId))
|
||||
{
|
||||
DestroyConnection(e.participantId);
|
||||
DeletePeerConnection(e.participantId);
|
||||
}
|
||||
onParticipantLeft?.Invoke(e.connectionId, e.participantId);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user