コード例 #1
0
ファイル: Transport.cs プロジェクト: huliang/BinaryNotes
        protected internal virtual bool processReceivedCallMessage(MessageEnvelope message)
        {
            bool result = false;

            if (message != null)
            {
                if (currentCallMessageId.Equals(message.Id))
                {
                    currentCallMessage = message;
                    result             = true;
                }
            }
            if (result)
            {
                callLockEvent.Set();
            }

            if (!result)
            {
                AsyncCallManager mgr             = socketFactory.getTransportFactory().AsyncCallManager;
                AsyncCallItem    callAsyncResult = mgr.getAsyncCall(message);
                if (callAsyncResult != null)
                {
                    result = true;
                    if (callAsyncResult.Listener != null)
                    {
                        callAsyncResult.Listener.onCallResult(callAsyncResult.Request, message);
                    }
                }
            }

            return(result);
        }
コード例 #2
0
        public virtual void  storeRequest(MessageEnvelope request, ITransportCallListener listener, int timeout)
        {
            AsyncCallItem item = new AsyncCallItem();

            item.Request  = request;
            item.Listener = listener;
            item.Timeout  = timeout;
            lock (asyncCalls)
            {
                asyncCalls.Add(request.Id, item);
            }
        }
コード例 #3
0
        public virtual AsyncCallItem getAsyncCall(System.String id)
        {
            AsyncCallItem res = null;

            lock (asyncCalls)
            {
                if (asyncCalls.ContainsKey(id))
                {
                    res = asyncCalls[id];
                }
                if (res != null)
                {
                    asyncCalls.Remove(id);
                }
            }
            return(res);
        }