Ejemplo n.º 1
0
        /// <summary>
        /// Fires the ClientHeartbeatReceived event.
        /// <remarks>
        /// Event is fired in a different thread to avoid blocking the client.
        /// </remarks>
        /// </summary>
        /// <param name="e">Event arguments</param>
        protected virtual void OnClientHeartbeatReceived(ClientHeartbeatEventArgs e)
        {
            var eventHandler = ClientHeartbeatReceived;

            if (eventHandler != null)
            {
                // the current session is preserved because it's a part of the LogicalCallContext
                ThreadPool.QueueUserWorkItem(state => eventHandler(this, e));
            }
        }
        /// <summary>
        /// Fires the ClientHeartbeatReceived event.
        /// </summary>
        /// <param name="e">Event arguments</param>
        protected virtual void OnClientHeartbeatReceived(ClientHeartbeatEventArgs e)
        {
            if (SessionManager.ExistSession(e.SessionID))
            {
                var session = SessionManager.GetSessionBySessionID(e.SessionID);
                session.Timestamp = DateTime.Now;

                if (ClientHeartbeatReceived != null)
                {
                    ClientHeartbeatReceived(this, e);
                }
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Fires the ClientHeartbeatReceived event.
        /// <remarks>
        /// Event is fired in a different thread to avoid blocking the client.
        /// </remarks>
        /// </summary>
        /// <param name="e">Event arguments</param>
        protected virtual void OnClientHeartbeatReceived(ClientHeartbeatEventArgs e)
        {
            var eventHandler = ClientHeartbeatReceived;

            if (eventHandler != null)
            {
                var currentSession = ServerSession.CurrentSession;
                ThreadPool.QueueUserWorkItem(state =>
                {
                    ServerSession.CurrentSession = currentSession;
                    eventHandler(this, e);
                });
            }
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Called, when dispatcher receives a heartbeat signal from a client.
 /// </summary>
 /// <param name="sender">Sender</param>
 /// <param name="e">Event arguments</param>
 private void _dispatcher_ClientHeartbeatReceived(object sender, ClientHeartbeatEventArgs e)
 {
     OnClientHeartbeatReceived(e);
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Fires the ClientHeartbeatReceived event.
 /// <remarks>
 /// Event is fired in a different thread to avoid blocking the client.
 /// </remarks>
 /// </summary>
 /// <param name="e">Event arguments</param>
 protected virtual void OnClientHeartbeatReceived(ClientHeartbeatEventArgs e)
 {
     var eventHandler = ClientHeartbeatReceived;
     if (eventHandler != null)
     {
         var currentSession = ServerSession.CurrentSession;
         ThreadPool.QueueUserWorkItem(state =>
         {
             ServerSession.CurrentSession = currentSession;
             eventHandler(this, e);
         });
     }
 }
Ejemplo n.º 6
0
 static void host_ClientHeartbeatReceived(object sender, ClientHeartbeatEventArgs e)
 {
     Console.WriteLine(string.Format("{0}: Received heartbeat from session {1}.", e.HeartbeatReceiveTime.ToString(), e.SessionID.ToString()));
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Fires the ClientHeartbeatReceived event.
 /// <remarks>
 /// Event is fired in a different thread to avoid blocking the client.
 /// </remarks>
 /// </summary>
 /// <param name="e">Event arguments</param>
 protected virtual void OnClientHeartbeatReceived(ClientHeartbeatEventArgs e)
 {
     var eventHandler = ClientHeartbeatReceived;
     if (eventHandler != null)
     {
         // the current session is preserved because it's a part of the LogicalCallContext
         ThreadPool.QueueUserWorkItem(state => eventHandler(this, e));
     }
 }