Пример #1
0
        public static bool IsSingle(this HttpPipe pipe)
        {
            switch (pipe)
            {
            case HttpPipe.SingleFirst:
            case HttpPipe.SingleLast:
                return(true);

            default:
                return(false);
            }
        }
Пример #2
0
        public HttpOp(IEngine engine, string url,
                      HttpPipe pipe = HttpPipe.Multiple, bool allowWriters = false)
        {
            this.engine = engine;
            this.pipe   = pipe;
            this.url    = url;

            Request    = engine.Op <TReq>(allowWriters);
            Response   = engine.Op <TRes>();
            Error      = engine.Op <HttpError>();
            Requesting = engine.El(0);
        }
Пример #3
0
        public override void Release()
        {
            if (currentChain == null)
            {
                base.Release();
                return;
            }

            HttpPipe pipe  = currentChain.GetFirstPipe();
            HttpPipe pipet = null;

            while (pipe != null)
            {
                pipet = pipe;
                pipe  = currentChain.GetNextPipe(pipe);
                pipet.Close();
            }

            currentChain.ChainState.Clear();

            if (currentChain.ChainState.ServerSocket != null && currentChain.ChainState.ServerSocket.Connected)
            {
                currentChain.ChainState.ServerSocket.Close();
            }

            if (currentChain.ChainState.ClientSocket != null && currentChain.ChainState.ClientSocket.Connected)
            {
                currentChain.ChainState.ClientSocket.Close();
            }

            currentChain.ChainState.ServerSocket = null;
            currentChain.ChainState.ClientSocket = null;
            currentChain.Clear();

            currentChain = null;

            base.Release();
        }