Esempio n. 1
0
        void MessageProgressCallback.replied(Parameters body, byte[] rawBody)
        {
            OutgoingMessage message = (OutgoingMessage)this;

            lock (message)
            {
                if (state == MessageState.POSTED ||
                    state == MessageState.TRANSMITTED)
                {
                    MessageState previousState = state;

                    state    = MessageState.REPLIED;
                    reply    = body;
                    rawReply = rawBody;

                    if (previousState == MessageState.POSTED)
                    {
                        transmitted = true;
                    }

                    completed = true;
                    Monitor.PulseAll(message);
                }
            }

            message.updateUserCallback();
        }
Esempio n. 2
0
        void MessageProgressCallback.rejected(string reason)
        {
            OutgoingMessage message = (OutgoingMessage)this;

            lock (message)
            {
                if (state == MessageState.POSTED ||
                    state == MessageState.TRANSMITTED)
                {
                    MessageState previousState = state;

                    state           = MessageState.REJECTED;
                    rejectionReason = reason;

                    if (previousState == MessageState.POSTED)
                    {
                        transmitted = true;
                    }

                    completed = true;
                    Monitor.PulseAll(message);
                }
            }

            message.updateUserCallback();
        }
Esempio n. 3
0
        void MessageProgressCallback.progress(
            int progrSentBytes, int progrTotalByteCount)
        {
            OutgoingMessage message = (OutgoingMessage)this;

            bool lastNotification = false;

            lock (message)
            {
                message.sentBytes      = progrSentBytes;
                message.totalByteCount = progrTotalByteCount;

                if (progrSentBytes == progrTotalByteCount)
                {
                    // there will be no more progress notifications
                    // for this message

                    lastNotification = true;

                    if (progrSentBytes != 0)
                    {
                        // the transmission of the whole message
                        // was successful

                        if (message.state == MessageState.POSTED)
                        {
                            message.state = MessageState.TRANSMITTED;

                            message.transmitted = true;
                            Monitor.PulseAll(message);
                        }
                    }
                    else
                    {
                        // the message was abandoned
                        // before it was fully transmitted

                        message.state = MessageState.ABANDONED;

                        message.transmitted = true;
                        message.completed   = true;
                        Monitor.PulseAll(message);
                    }
                }
            }

            if (lastNotification)
            {
                // the message is treated as leaving the output queue

                message.outgoingFlowManager.decrease();

                message.updateUserCallback();
            }
        }