コード例 #1
0
ファイル: LocalNode.cs プロジェクト: xhnice/neo
        private async Task ProcessWebSocketAsync(HttpContext context)
        {
            if (!context.WebSockets.IsWebSocketRequest)
            {
                return;
            }
            WebSocket ws = await context.WebSockets.AcceptWebSocketAsync();

            WebSocketRemoteNode remoteNode = new WebSocketRemoteNode(this, ws, new IPEndPoint(context.Connection.RemoteIpAddress, context.Connection.RemotePort));

            OnConnected(remoteNode);
        }
コード例 #2
0
        private async Task ProcessWebSocketAsync(HttpContext context)
        {
            TR.Enter();
            if (!context.WebSockets.IsWebSocketRequest)
            {
                TR.Exit();
                return;
            }
            IndentContext ic = TR.SaveContextAndShuffle();
            WebSocket     ws = await context.WebSockets.AcceptWebSocketAsync();

            TR.RestoreContext(ic);
            WebSocketRemoteNode remoteNode = new WebSocketRemoteNode(this, ws, new IPEndPoint(context.Connection.RemoteIpAddress, context.Connection.RemotePort));

            OnConnected(remoteNode);
            TR.Exit();
        }