Example #1
0
 public void AsyncProcessRequest(IClientChannelSinkStack sinkStack, IMessage msg, ITransportHeaders headers, Stream stream)
 {
     CompressSinkHelper.SetClientSupportCompressFlag(headers);
     stream = CompressSinkHelper.CompressStream(headers, stream);
     sinkStack.Push(this, null);
     _next.AsyncProcessRequest(sinkStack, msg, headers, stream);
 }
Example #2
0
 public void ProcessMessage(IMessage msg, ITransportHeaders requestHeaders, Stream requestStream, out ITransportHeaders responseHeaders, out Stream responseStream)
 {
     CompressSinkHelper.SetClientSupportCompressFlag(requestHeaders);
     requestStream = CompressSinkHelper.CompressStream(requestHeaders, requestStream);
     _next.ProcessMessage(msg, requestHeaders, requestStream, out responseHeaders, out responseStream);
     responseStream = CompressSinkHelper.DecompressStream(responseHeaders, responseStream);
 }
Example #3
0
        public ServerProcessing ProcessMessage(IServerChannelSinkStack sinkStack, IMessage requestMsg, ITransportHeaders requestHeaders, Stream requestStream, out IMessage responseMsg, out ITransportHeaders responseHeaders, out Stream responseStream)
        {
            if (requestMsg != null)
            {
                return(_next.ProcessMessage(sinkStack, requestMsg, requestHeaders, requestStream, out responseMsg, out responseHeaders, out responseStream));
            }

            try
            {
                IPAddress IPAddr = (IPAddress)requestHeaders[CommonTransportKeys.IPAddress];
                //===================================
                //Console.WriteLine(IPAddr.ToString());
                //====================================
                CallContext.SetData("ClientIP", IPAddr);
                //IPHostEntry hostInfo = Dns.Resolve("");
                //string _hs = requestHeaders[CommonTransportKeys.RequestUri].ToString() ;
                //CallContext.SetData("ClientHost",_hs);
            }
            catch (Exception ex)
            {
                string errmsg = ex.Message;
            }

            requestStream = CompressSinkHelper.DecompressStream(requestHeaders, requestStream);
            sinkStack.Push(this, null);
            ServerProcessing processing = _next.ProcessMessage(sinkStack, null, requestHeaders, requestStream, out responseMsg, out responseHeaders, out responseStream);

            //	这样写是否有效还未验证, ???
            //			if (CompressSinkHelper.IsClientSupportCompress(requestHeaders))
            //				CompressSinkHelper.SetClientSupportCompressFlag(responseHeaders);

            switch (processing)
            {
            case ServerProcessing.Complete:
                sinkStack.Pop(this);
                if (CompressSinkHelper.IsClientSupportCompress(requestHeaders))
                {
                    responseStream = CompressSinkHelper.CompressStream(responseHeaders, responseStream);
                }
                break;

            case ServerProcessing.OneWay:
                sinkStack.Pop(this);
                break;

            case ServerProcessing.Async:
                sinkStack.Store(this, null);
                break;
            }
            return(processing);
        }
Example #4
0
        public void AsyncProcessResponse(IServerResponseChannelSinkStack sinkStack, object state, IMessage msg, ITransportHeaders headers, Stream stream)
        {
            try
            {
                IPAddress IPAddr = (IPAddress)headers[CommonTransportKeys.IPAddress];
                //====================================
                //Console.WriteLine(IPAddr.ToString());
                //====================================
                CallContext.SetData("ClientIP", IPAddr);
                //IPHostEntry hostInfo = Dns.Resolve("");
                //string _hs = headers[CommonTransportKeys.RequestUri].ToString() ;
                //CallContext.SetData("ClientHost",_hs);
            }
            catch (Exception ex)
            {
                string errmsg = ex.Message;
            }


            //if (CompressSinkHelper.IsClientSupportCompress(headers))
            stream = CompressSinkHelper.CompressStream(headers, stream);
            sinkStack.AsyncProcessResponse(msg, headers, stream);
        }
Example #5
0
 public void AsyncProcessResponse(IClientResponseChannelSinkStack sinkStack, object state, ITransportHeaders headers, Stream stream)
 {
     CompressSinkHelper.DecompressStream(headers, stream);
     sinkStack.AsyncProcessResponse(headers, stream);
 }