本文整理汇总了C#中DisconnectReason类的典型用法代码示例。如果您正苦于以下问题:C# DisconnectReason类的具体用法?C# DisconnectReason怎么用?C# DisconnectReason使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DisconnectReason类属于命名空间,在下文中一共展示了DisconnectReason类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnDisconnect
protected override void OnDisconnect(DisconnectReason reasonCode, string reasonDetail)
{
var remoteAddress = this.RemoteIP + ":" + this.RemotePort;
PhotonWireApplicationBase.Instance.Logger.InboundPeerOnDisconnect(PhotonWireApplicationBase.Instance.ApplicationName, remoteAddress, this.ConnectionId, reasonCode.ToString(), reasonDetail);
PeerManager.InboundServerConnections.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);
}
}
示例2: OnDisconnect
protected override void OnDisconnect(DisconnectReason reasonCode, string reasonDetail)
{
lock (StarCollectorGame.Instance)
{
StarCollectorGame.Instance.PeerLeft(this);
}
}
示例3: DisconnectMessageConstructorTest1
public void DisconnectMessageConstructorTest1()
{
DisconnectReason reasonCode = new DisconnectReason(); // TODO: Initialize to an appropriate value
string message = string.Empty; // TODO: Initialize to an appropriate value
DisconnectMessage target = new DisconnectMessage(reasonCode, message);
Assert.Inconclusive("TODO: Implement code to verify target");
}
示例4: SshConnectionExceptionConstructorTest2
public void SshConnectionExceptionConstructorTest2()
{
string message = string.Empty; // TODO: Initialize to an appropriate value
DisconnectReason disconnectReasonCode = new DisconnectReason(); // TODO: Initialize to an appropriate value
SshConnectionException target = new SshConnectionException(message, disconnectReasonCode);
Assert.Inconclusive("TODO: Implement code to verify target");
}
示例5: CloseConnection
private void CloseConnection(bool force, DisconnectReason reason, int socketErrorCode)
{
lock (_connectionCloseLock)
{
//Nothing to do
if (!IsRunning)
return;
//Send goodbye
if (_peer != null && !force && _connected)
{
//Send disconnect data
var disconnectPacket = NetPacket.CreateRawPacket(PacketProperty.Disconnect, 8);
FastBitConverter.GetBytes(disconnectPacket, 1, _connectId);
SendRaw(disconnectPacket, _peer.EndPoint);
}
//Clear data
_peer = null;
_connected = false;
_connectTimer = 0;
_connectAttempts = 0;
SocketClearPeers();
//Send event to Listener
var netEvent = CreateEvent(NetEventType.Disconnect);
netEvent.DisconnectReason = reason;
netEvent.AdditionalData = socketErrorCode;
EnqueueEvent(netEvent);
}
}
示例6: OnDisconnect
protected override void OnDisconnect(DisconnectReason reasonCode, string reasonDetail)
{
if (log.IsDebugEnabled)
{
log.DebugFormat("Latency monitoring client disconnected: reason={0}, detail{1}", reasonCode, reasonDetail);
}
}
示例7: OnDisconnect
protected override void OnDisconnect(DisconnectReason reasonCode, string reasonDetail)
{
lock (syncRoot)
{
BroadcastMessage -= this.OnBroadcastMessage;
}
}
示例8: OnDisconnect
protected override void OnDisconnect(DisconnectReason reasonCode, string reasonDetail)
{
lock (ServerArena.Instance)
{
ServerArena.Instance.Exit(this);
}
}
示例9: OnDisconnect
protected override void OnDisconnect(DisconnectReason reasonCode, string reasonDetail)
{
World.Instance.RemoveClient(this);
var sendParameters = new SendParameters();
sendParameters.Unreliable = true;
WorldExitHandler(sendParameters);
Log.Debug("Disconnected!");
}
示例10: IsDefined
public static bool IsDefined(DisconnectReason value)
{
if ((((value != DisconnectReason.LeavingMesh) && (value != DisconnectReason.NotUsefulNeighbor)) && ((value != DisconnectReason.DuplicateNeighbor) && (value != DisconnectReason.DuplicateNodeId))) && (value != DisconnectReason.NodeBusy))
{
return (value == DisconnectReason.InternalFailure);
}
return true;
}
示例11: DisconnectMessage
/// <summary>
/// Initializes a new instance of the <see cref="DisconnectMessage"/> class.
/// </summary>
/// <param name="reasonCode">The reason code.</param>
/// <param name="message">The message.</param>
public DisconnectMessage(DisconnectReason reasonCode, string message)
{
ReasonCode = reasonCode;
Description = message;
#if TUNING
Language = "en";
#endif
}
示例12: DisconnectMessage
public DisconnectMessage(DisconnectReason reasonCode, string description = "", string language = "en")
{
Contract.Requires(description != null);
Contract.Requires(language != null);
ReasonCode = reasonCode;
Description = description;
Language = language;
}
示例13: OnDisconnectStatic
public static bool OnDisconnectStatic(DisconnectReason reason, string message)
{
if (Settings.AutoRelog_Enabled)
{
AutoRelog bot = new AutoRelog(Settings.AutoRelog_Delay, Settings.AutoRelog_Retries);
return bot.OnDisconnect(reason, message);
}
return false;
}
示例14: OnDisconnect
/// <summary>
/// Called when Photon internally disconnects the peer.
/// </summary>
/// <param name="reasonCode">Reason for disconnecting.</param>
/// <param name="reasonDetail">Detailed reason string.</param>
protected override void OnDisconnect(DisconnectReason reasonCode, string reasonDetail)
{
//Null the peer out otherwise we will leak. Trust me.
GladNetPeer = null;
//Disconnects the peer
disconnectionServiceHandler.Disconnect();
networkReciever.OnNetworkMessageReceive(new PhotonStatusMessageAdapter(NetStatus.Disconnected), null);
}
示例15: MasterEmulator
//, own_address=None, bond_info=None):
public MasterEmulator( String peer_device_address, Int32 baud_rate=1000000 )
{
this.peer_device_address = peer_device_address;
this.num_of_errors = 0;
//logger = TimestampLogger();
this.connected = false;
this.disconnect_event_expected = true;
this.service_setup_done = true;
this.last_disconnect_reason = DisconnectReason.UnspecifiedError; // = -1;
this.baud_rate = baud_rate;
//this.own_address = own_address;
//this.bond_info = bond_info;
}