Esempio n. 1
0
        private async void ExecuteConnection(SocketConnection conn)
        {
            try
            {
                await Callback?.Invoke(conn);
            }
            catch
            {

            }
            finally
            {
                conn.Dispose();
            }
        }
Esempio n. 2
0
        private void OnAccept(SocketAsyncEventArgs e)
        {
            if (e.SocketError == SocketError.Success)
            {
                var conn = new SocketConnection(e.AcceptSocket, PipelineFactory);
                e.AcceptSocket = null;
                ExecuteConnection(conn);
            }

            // note that we don't want to call BeginAccept at the end of OnAccept, as that
            // will cause a stack-dive in the sync (backlog) case
        }