コード例 #1
0
ファイル: SocketListener.cs プロジェクト: ststeiger/NancyHub
//		#region Events to receive records
//		/// <summary>
//		/// Upon receiving a record with this event, do not run any blocking code, or the application's main loop will block as well.
//		/// </summary>
//		public event ReceiveBeginRequestRecord OnReceiveBeginRequestRecord = delegate {};
//		/// <summary>
//		/// Upon receiving a record with this event, do not run any blocking code, or the application's main loop will block as well.
//		/// </summary>
//		public event ReceiveParamsRecord OnReceiveParamsRecord = delegate {};
//		/// <summary>
//		/// Upon receiving a record with this event, do not run any blocking code, or the application's main loop will block as well.
//		/// </summary>
//		public event ReceiveStdinRecord OnReceiveStdinRecord = delegate {};
//		/// <summary>
//		/// Upon receiving a record with this event, do not run any blocking code, or the application's main loop will block as well.
//		/// </summary>
//		public event ReceiveStdoutRecord OnReceiveStdoutRecord = delegate {};
//		#endregion

        /// <summary>
        /// Closes and disposes of a Request and its Socket while also removing it from the internal collection of open sockets.
        /// </summary>
        private void OnAbruptSocketClose(Socket sock, FosRequest fosRequest)
        {
            FosRequest trash;

            OpenSockets.TryRemove(sock, out trash);
            fosRequest.Dispose();

            if (Logger != null)
            {
                Logger.LogConnectionClosedAbruptly(sock, new RequestInfo(fosRequest));
            }
        }