Наследование: Bolt.IProtocolToken
Пример #1
0
 protected override void OnDisconnect(DisconnectReason reasonCode, string reasonDetail)
 {
     lock (ServerArena.Instance)
     {
         ServerArena.Instance.Exit(this);
     }
 }
 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");
 }
Пример #3
0
        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);
            }
        }
Пример #4
0
 protected override void OnDisconnect(DisconnectReason reasonCode, string reasonDetail)
 {
     lock (syncRoot)
     {
         BroadcastMessage -= this.OnBroadcastMessage;
     }
 }
Пример #5
0
        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);
            }
        }
Пример #6
0
 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");
 }
Пример #7
0
 protected override void OnDisconnect(DisconnectReason reasonCode, string reasonDetail)
 {
     if (log.IsDebugEnabled)
     {
         log.DebugFormat("Latency monitoring client disconnected: reason={0}, detail{1}", reasonCode, reasonDetail);
     }
 }
 protected override void OnDisconnect(DisconnectReason reasonCode, string reasonDetail)
 {
     lock (StarCollectorGame.Instance)
     {
         StarCollectorGame.Instance.PeerLeft(this);
     }
 }
 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;
 }
Пример #10
0
 protected override void OnDisconnect(DisconnectReason reasonCode, string reasonDetail)
 {
     World.Instance.RemoveClient(this);
     var sendParameters = new SendParameters();
     sendParameters.Unreliable = true;
     WorldExitHandler(sendParameters);
     Log.Debug("Disconnected!");
 }
Пример #11
0
        /// <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
0
 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;
 }
Пример #13
0
        public DisconnectMessage(DisconnectReason reasonCode, string description = "", string language = "en")
        {
            Contract.Requires(description != null);
            Contract.Requires(language != null);

            ReasonCode = reasonCode;
            Description = description;
            Language = language;
        }
		/// <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
0
        //, 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;
        }
Пример #16
0
 public override bool OnDisconnect(DisconnectReason reason, string message)
 {
     message = GetVerbatim(message);
     string comp = message.ToLower();
     foreach (string msg in dictionary)
     {
         if (comp.Contains(msg))
         {
             LogToConsole("Waiting " + delay + " seconds before reconnecting...");
             System.Threading.Thread.Sleep(delay * 1000);
             McTcpClient.ReconnectionAttemptsLeft = attempts;
             ReconnectToTheServer();
             return true;
         }
     }
     return false;
 }
Пример #17
0
 protected override void OnDisconnect(DisconnectReason reasonCode, string reasonDetail)
 {
     if (!DisconnectAsWanderer())
     {
         if (!DisconnectAsPlayer())
         {
             REServer.log.Info("Disconnect Error because we don't know what is the target");
         }
         else
         {
             REServer.log.Info(player.account + ": Disconnet");
         }
     }
     else
     {
         REServer.log.Info(guid+": Disconnet");
     }
 }
Пример #18
0
 public void OnDisconnected (DisconnectReason reason, string message)
 {
     SparkleLogger.LogInfo ("Listener", "Disconnected from " + Server + ": " + message);
     Disconnected (reason);
 }
Пример #19
0
        /// <summary>
        ///   Called when client disconnects.
        ///   Ensures that disconnected players leave the game <see cref = "Room" />.
        ///   The player is not removed immediately but a message is sent to the room. This avoids
        ///   threading issues by making sure the player remove is not done concurrently with operations.
        /// </summary>
        protected override void OnDisconnect(DisconnectReason reasonCode, string reasonDetail)
        {
            if (log.IsDebugEnabled)
            {
                log.DebugFormat("OnDisconnect: conId={0}, reason={1}, reasonDetail={2}", this.ConnectionId, reasonCode, reasonDetail);
            }

            if (this.RoomReference == null)
            {
                return;
            }

            var message = new RoomMessage((byte)GameMessageCodes.RemovePeerFromGame, this);
            this.RoomReference.Room.EnqueueMessage(message);
            this.RoomReference.Dispose();
            this.RoomReference = null;
        }
Пример #20
0
        private void ListenerDisconnectedDelegate (DisconnectReason reason)
        {
            SparkleLogger.LogInfo (Name, "Falling back to regular polling");
            this.poll_interval = PollInterval.Short;

            this.last_disconnect_reason = reason;

            if (reason == DisconnectReason.SystemSleep) {
                this.remote_timer.Stop ();

                int backoff_time = 2;

                do {
                    SparkleLogger.LogInfo (Name, "Next reconnect attempt in " + backoff_time + " seconds");
                    Thread.Sleep (backoff_time * 1000);
                    this.listener.Connect ();
                    backoff_time *= 2;
                
                } while (backoff_time < 64 && !this.listener.IsConnected);

                this.remote_timer.Start ();
            }
        }
Пример #21
0
 public DisconnectEventArgs( DisconnectReason reason, String comment )
 {
     Reason = reason;
     Comment = comment;
 }
Пример #22
0
 public SshConnectionException(string message, DisconnectReason disconnectReason = DisconnectReason.None)
     : base(message)
 {
     DisconnectReason = disconnectReason;
 }
Пример #23
0
 public void OnPeerDisconnected(NetPeer peer, DisconnectReason disconnectReason, int socketErrorCode)
 {
     Console.WriteLine("[Client] disconnected: " + disconnectReason);
 }
Пример #24
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SshConnectionException"/> class.
 /// </summary>
 /// <param name="message">The message.</param>
 public SshConnectionException(string message)
     : base(message)
 {
     DisconnectReason = DisconnectReason.None;
 }
Пример #25
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="DisconnectEventArgs" /> class.
 /// </summary>
 /// <param name="reason">The reason.</param>
 public DisconnectEventArgs(DisconnectReason reason)
 {
     Reason = reason;
 }
Пример #26
0
 public abstract void InitiateDisconnect(DisconnectReason disconnectReason, string details);
Пример #27
0
 public DisconnectEventArgs(DisconnectReason disconnectReason, DisconnectType disconnectType, string details)
 {
     DisconnectReason = disconnectReason;
     DisconnectType   = disconnectType;
     Details          = details;
 }
Пример #28
0
 private PlayerServer()
 {
     ExitReason             = DisconnectReason.AllGood;
     ApproveLoadWorldReason = ApproveLoadWorldReason.LoginOk;
 }
Пример #29
0
        protected override void OnDisconnect(DisconnectReason reasonCode, string reasonDetail)
        {
            _peerCollection.Remove(ClientId);

            BroadcastNotify -= broadcastNotify; // un-sub event
        }
 public override void DisconnectProtocol(DisconnectReason disconnectReason, string details)
 {
     Dispose();
 }
Пример #31
0
 private void Disconnect(ISession session, DisconnectReason reason, string details)
 {
     session.InitiateDisconnect(reason, details);
 }
Пример #32
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="DisconnectEventArgs" /> class.
 /// </summary>
 /// <param name="reason">The reason.</param>
 public DisconnectEventArgs(DisconnectReason reason)
 {
     Reason = reason;
 }
Пример #33
0
 public void KickConnection(NetConnection connection, DisconnectReason reason, string additionalInfo = null)
 {
     connection.Disconnect(reason, additionalInfo);
 }
 /// <summary>
 /// Is called when the client has been disconnected fom the server
 /// </summary>
 /// <param name="reason">Disconnect Reason</param>
 /// <param name="message">Kick message, if any</param>
 /// <returns>Return TRUE if the client is about to restart</returns>
 public virtual bool OnDisconnect(DisconnectReason reason, string message)
 {
     return(false);
 }
Пример #35
0
 public virtual void OnDisconnect(DisconnectReason reasonCode, string reasonDetail)
 {
     this.ReconnectToMaster();
     this.Application.OnDisconnectFromMaster(this);
 }
Пример #36
0
 public void OnPeerDisconnected(NetPeer peer, DisconnectReason disconnectReason, int socketErrorCode)
 {
     Console.WriteLine("[Server] Peer disconnected: " + peer.EndPoint + ", reason: " + disconnectReason);
 }
Пример #37
0
 public void Disconnect()
 {
     _messageProvider.Disconnect();
     _disconnectReason = DisconnectReason.User;
 }
Пример #38
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SshConnectionException"/> class.
 /// </summary>
 /// <param name="message">The message.</param>
 /// <param name="disconnectReasonCode">The disconnect reason code.</param>
 /// <param name="inner">The inner.</param>
 public SshConnectionException(string message, DisconnectReason disconnectReasonCode, Exception inner)
     : base(message, inner)
 {
     DisconnectReason = disconnectReasonCode;
 }
Пример #39
0
 public WiimoteDisconnectedEventArgs(Wiimote wiimote, DisconnectReason reason)
     : base(wiimote)
 {
     Reason = reason;
 }
Пример #40
0
 public override void onDisconnect(DisconnectReason Reason)
 {
 }
Пример #41
0
 public void Disconnect(DisconnectReason reason, string details)
 {
     Disconnected?.Invoke(this, EventArgs.Empty);
 }
Пример #42
0
 protected override void OnDisconnect(DisconnectReason reasonCode, string reasonDetail)
 {
     base.OnDisconnect(reasonCode, reasonDetail);
     this.onDisconnectEvent.Set();
 }
Пример #43
0
 public Task DisconnectAsync(DisconnectReason disconnectReason, DisconnectType disconnectType)
 {
     return(Task.CompletedTask);
 }
Пример #44
0
        private void ListenerConnectedDelegate ()
        {
            if (this.last_disconnect_reason == DisconnectReason.SystemSleep) {
                this.last_disconnect_reason = DisconnectReason.None;

                if (HasRemoteChanges && !this.is_syncing)
                    SyncDownBase ();
            }

            this.poll_interval = PollInterval.Long;
        }
Пример #45
0
 public Task InitiateDisconnectAsync(DisconnectReason disconnectReason)
 {
     Disconected      = true;
     DisconnectReason = disconnectReason;
     return(Task.CompletedTask);
 }
Пример #46
0
 private void DisconnectUnauthClient(NetIncomingMessage inc, UnauthenticatedClient unauthClient, DisconnectReason reason, string message)
 {
     inc.SenderConnection.Disconnect(reason.ToString() + "/ " + TextManager.GetServerMessage(message));
     if (unauthClient.SteamID > 0)
     {
         Steam.SteamManager.StopAuthSession(unauthClient.SteamID);
     }
     if (unauthClient != null)
     {
         unauthenticatedClients.Remove(unauthClient);
     }
 }
 public ConnectionClosedEventArgs(UdpConnection connection, DisconnectReason reason, UdpRawMessage payload)
 {
     this.Connection = connection;
     this.Reason     = reason;
     this.Payload    = payload;
 }
 /// <summary>
 /// Reads the payload.
 /// </summary>
 /// <param name="message">The message.</param>
 public override void ReadPayload(NetIncomingMessage message)
 {
     base.ReadPayload(message);
     Reason = (DisconnectReason) message.ReadByte();
 }
Пример #49
0
 public void Disconnect(DisconnectReason reason, string details)
 {
     throw new NotImplementedException();
 }
Пример #50
0
        /// <summary>
        /// Is called when the client has been disconnected fom the server
        /// </summary>
        /// <param name="reason">Disconnect Reason</param>
        /// <param name="message">Kick message, if any</param>
        /// <returns>Return TRUE if the client is about to restart</returns>

        public virtual bool OnDisconnect(DisconnectReason reason, string message) { return false; }
Пример #51
0
 public ClientDisconnected(INatsClient client, DisconnectReason reason)
 {
     Client = client;
     Reason = reason;
 }