Example #1
0
 /// <summary>
 ///     Stops given peer.
 /// </summary>
 private static void InternalStopPeer([NotNull] QNetPeer peer, string stopReason)
 {
     if (peer == null)
     {
         throw new ArgumentNullException(nameof(peer));
     }
     if (!InternalRunningPeers.Contains(peer))
     {
         throw new InvalidOperationException(
                   "Unable to stop given peer. Given peer can't be stopped while not started.");
     }
     // remove this peer
     InternalRunningPeers.Remove(peer);
     // rebuild array
     RunningPeers = InternalRunningPeers.ToArray();
     // and then stop
     peer.Stop(stopReason);
 }