Beispiel #1
0
        /*------------------------- End of  Transport interface ---------------------------*/



        public override void  up(Event evt)
        {
            switch (evt.Type)
            {
            case Event.ACK_OK:
                ack_promise.SetResult((object)true);
                return;

            case Event.START_OK:
                if (start_promise != null)
                {
                    start_promise.SetResult(evt.Arg);
                }
                return;

            case Event.STOP_OK:
                if (stop_promise != null)
                {
                    stop_promise.SetResult(evt.Arg);
                }
                return;
            }

            if (channel != null)
            {
                channel.up(evt);
            }
        }
        /// <summary>
        /// Receives events from the top of the stack
        /// </summary>
        /// <param name="evt">Event received</param>
        public override void up(Event evt)
        {
            Object      obj;
            Message     msg;
            StackHeader hdr;

            switch (evt.Type)
            {
            case Event.SET_LOCAL_ADDRESS:
                local_addr = (Address)evt.Arg;
                break;

            case Event.MSG:
                msg = (Message)evt.Arg;
                obj = msg.getHeader(name);
                if (obj == null || !(obj is StackHeader))
                {
                    break;
                }
                hdr = (StackHeader)msg.removeHeader(name);
                if (Trace.trace)
                {
                    Trace.info("ProtocolSinkStack.up()", "received MSG : " + StackHeader.type2String(hdr.Type));
                }
                if (hdr.Type == StackHeader.REMOTE_RSP)
                {
                    handleRemotingResponse(hdr);
                }
                else if (hdr.Type == StackHeader.REMOTE_REQ)
                {
                    handleRemotingRequest(hdr);
                }
                else
                {
                    if (Trace.trace)
                    {
                        Trace.error("GMS.up()", "StackHeader with type=" + hdr.Type + " not known");
                    }
                }
                return;                         // don't pass up

            case Event.VIEW_CHANGE:
                ArrayList tmp;
                if ((tmp = ((View)evt.Arg).getMembers()) != null)
                {
                    lock (members)
                    {
                        members.Clear();
                        for (int i = 0; i < tmp.Count; i++)
                        {
                            members.Add(tmp[i]);
                        }
                    }
                }
                break;
            }

            if (channel != null)
            {
                channel.up(evt);
            }
        }