protected override void OnDisconnect(DisconnectReason reasonCode, string reasonDetail)
{
PhotonWireApplicationBase.Instance.Logger.OutboundPeerOnDisconnect(PhotonWireApplicationBase.Instance.ApplicationName, RemoteEndPoint?.ToString(), ApplicationName, this.ConnectionId, reasonCode.ToString(), reasonDetail);
PeerManager.OutboundServerConnections.Remove(this);
List<Exception> exceptions = new List<Exception>();
Action<int, string>[] copy;
lock (disconnectActions)
{
if (disconnectActions.Count == 0) return;
copy = new Action<int, string>[disconnectActions.Count];
disconnectActions.CopyTo(copy);
}
foreach (var item in copy)
{
try
{
item((int)reasonCode, reasonDetail);
}
catch (Exception ex)
{
exceptions.Add(ex);
}
}
if (exceptions.Count > 0)
{
throw new AggregateException(exceptions);
}
}