Beispiel #1
0
        public async Task <FrameData> QueryAsync(byte[] titleBytes, byte[] contentBytes, byte[] extentionBytes = null, bool throwIfErrorResponseCode = true)
        {
            if (_client == null)
            {
                throw new RpcException("client has been closed");
            }

            return(await _client.QueryAsync(titleBytes, contentBytes, extentionBytes, throwIfErrorResponseCode));
        }
Beispiel #2
0
        public async Task <FrameData> QueryAsync(byte[] titleBytes, byte[] contentBytes, byte[] extentionBytes = null, bool throwIfErrorResponseCode = true)
        {
            if (_client == null)
            {
                throw new RpcException("FastRpcClient QueryAsync failed,client has been closed");
            }

            var originalQueryState = Interlocked.CompareExchange(ref _queryState, 1, 0);

            if (originalQueryState != 0)
            {
                throw new RpcException("FastRpcClient QueryAsync failed,client is querying");
            }

            try
            {
                TransportKeepAlive();
                return(await _client.QueryAsync(titleBytes, contentBytes, extentionBytes, throwIfErrorResponseCode).ConfigureAwait(false));
            }
            finally
            {
                _queryState = 0;
            }
        }