Exemplo n.º 1
0
        internal Message SendWithReplyAndBlock(Message msg)
        {
            if (signalThread == null)
            {
                return(null);
            }

            // if a seperate thread is handling receiving messages.
            if (signalThread.IsAlive)
            {
                // wait until receiving thread calls waitForReplyEvent.
                if (!this.isConnected)
                {
                    return(null);
                }

                SendWithReply(msg);
                waitForReplyEvent.WaitOne();
                return(returnMessage);
            }
            else
            {
                PendingCall pending = SendWithReply(msg);
                return(pending.Reply);
            }
        }
Exemplo n.º 2
0
        internal PendingCall SendWithReply(Message msg)
        {
            msg.ReplyExpected = true;
            msg.Header.Serial = GenerateSerial();

            //TODO: throttle the maximum number of concurrent PendingCalls
            PendingCall pending = new PendingCall(this);

            pendingCalls[msg.Header.Serial] = pending;

            WriteMessage(msg);

            return(pending);
        }
Exemplo n.º 3
0
        internal PendingCall SendWithReply(Message msg)
        {
            msg.ReplyExpected = true;

            if (msg.Header.Serial == 0)
            {
                msg.Header.Serial = GenerateSerial();
            }

            // Should we throttle the maximum number of concurrent PendingCalls?
            // Should we support timeouts?
            PendingCall pending = new PendingCall(this);

            pendingCalls[msg.Header.Serial] = pending;

            Send(msg);
            //WriteMessage (msg);

            return(pending);
        }
Exemplo n.º 4
0
        internal Message SendWithReplyAndBlock(Message msg)
        {
            PendingCall pending = SendWithReply(msg);

            return(pending.Reply);
        }