/// <summary> /// Disconnects this peer /// </summary> /// <param name="reason">Disconnection reason</param> public override void Disconnect(EDisconnectionReason reason) { try { Peer.Disconnect((uint)reason); } catch (Exception e) { Console.Error.WriteLine(e); } }
/// <summary> /// Constructs a message informing about an useer leaving the lobby /// </summary> /// <param name="user">User</param> /// <param name="reason">Reason</param> /// <param name="message">Message</param> public UserLeftMessageData(IUser user, EDisconnectionReason reason, string message) : base(Naming.GetMessageTypeNameFromMessageDataType <UserLeftMessageData>()) { if (user == null) { throw new ArgumentNullException(nameof(user)); } if (!user.IsValid) { throw new ArgumentException("User is not valid.", nameof(user)); } if (reason == EDisconnectionReason.Invalid) { throw new ArgumentException("Reason can't be invalid.", nameof(reason)); } GUID = user.GUID; Reason = reason; Message = message ?? throw new ArgumentNullException(nameof(message)); }
/// <summary> /// Disconnects an user /// </summary> /// <param name="reason">Reason</param> public void Disconnect(EDisconnectionReason reason) => Peer.Disconnect(reason);
/// <summary> /// Disconnects this user /// </summary> /// <param name="reason">Disconnection reason</param> public virtual void Disconnect(EDisconnectionReason reason) => ServerUser.Disconnect(reason);
/// <summary> /// Closes the connection to peer /// </summary> /// <param name="reason">Disconnection reason</param> public abstract void Disconnect(EDisconnectionReason reason);
/// <summary> /// Disconnects peer /// </summary> /// <param name="reason">Reason</param> public override void Disconnect(EDisconnectionReason reason) => InternalOwningConnector.DisconnectPeer(this);
/// <summary> /// Closes connection to all peers /// </summary> /// <param name="reason">Disconnection reason</param> public override void Close(EDisconnectionReason reason) { base.Close(reason); isConnectorThreadRunning = false; connectorThread.Join(); }