示例#1
0
        public void Parse(HttpListenerContext httpContext)
        {
            try
            {
                var httpRequest = httpContext.Request;

                using (var reader = new StreamReader(httpRequest.InputStream, Encoding.UTF8))
                {
                    var line       = reader.ReadToEnd();
                    var rpcContext = new GetworkContext(this, httpContext);

                    _packetLogger.Verbose("rx: {0}", line.PrettifyJson());

                    var async = new JsonRpcStateAsync(_rpcResultHandler, rpcContext)
                    {
                        JsonRpc = line
                    };
                    JsonRpcProcessor.Process(Pool.Config.Coin.Name, async, rpcContext);
                }
            }
            catch (JsonReaderException e) // if client sent an invalid message
            {
                _logger.Error("Skipping invalid json-rpc request - {0:l}", e.Message);
            }
        }
示例#2
0
        public void Parse(HttpListenerContext httpContext)
        {
            try
            {
                var httpRequest = httpContext.Request;

                using (var reader = new StreamReader(httpRequest.InputStream, Encoding.UTF8))
                {
                    var line = reader.ReadToEnd();
                    var rpcContext = new GetworkContext(this, httpContext);

                    _packetLogger.Verbose("rx: {0}", line.PrettifyJson());

                    var async = new JsonRpcStateAsync(_rpcResultHandler, rpcContext) {JsonRpc = line};
                    JsonRpcProcessor.Process(Pool.Config.Coin.Name, async, rpcContext);
                }
            }
            catch (JsonReaderException e) // if client sent an invalid message
            {
                _logger.Error("Skipping invalid json-rpc request - {0:l}", e.Message);
            }
        }