type() public method

public type ( ) : int
return int
Exemplo n.º 1
0
        /*
         * called by OtpNode to deliver message to this mailbox.
         *
         * About exit and exit2: both cause exception to be raised upon
         * receive(). However exit (not 2) causes any link to be removed as
         * well, while exit2 leaves any links intact.
         */
        internal virtual void  deliver(OtpMsg m)
        {
            switch (m.type())
            {
            case OtpMsg.Tag.linkTag:
                links.addLink(_self, m.getSenderPid());
                break;

            case OtpMsg.Tag.unlinkTag:
                links.removeLink(_self, m.getSenderPid());
                break;

            case OtpMsg.Tag.exitTag:
                links.removeLink(_self, m.getSenderPid());
                queue.put(m);
                break;

            case OtpMsg.Tag.monitorPTag:
                monitors[m.getSenderPid()] = m.getMsg();
                break;

            case OtpMsg.Tag.demonitorPTag:
                monitors.Remove(m.getSenderPid());
                break;

            case OtpMsg.Tag.monitorPexitTag:
                queue.put(m);
                break;

            case OtpMsg.Tag.exit2Tag:
            default:
                queue.put(m);
                break;
            }
        }
Exemplo n.º 2
0
        /*
         * pass the message to the node for final delivery. Note that the
         * connection itself needs to know about links (in case of connection
         * failure), so we snoop for link/unlink too here.
         */
        public override void  deliver(OtpMsg msg)
        {
            bool delivered = self.deliver(msg);

            switch (msg.type())
            {
            case OtpMsg.Tag.linkTag:
                if (delivered)
                {
                    links.addLink(msg.getRecipientPid(), msg.getSenderPid());
                }
                else
                {
                    try
                    {
                        // no such pid - send exit to sender
                        base.sendExit(msg.getRecipientPid(), msg.getSenderPid(), "noproc");
                    }
                    catch (System.IO.IOException)
                    {
                    }
                }
                break;

            case OtpMsg.Tag.monitorPTag:
                if (delivered)
                {
                    monitors[msg.getSenderPid()] = msg.getMsg();
                }
                else
                {
                    try
                    {
                        base.sendExit(msg.getRecipientPid(), msg.getSenderPid(), "noproc");
                    }
                    catch (System.IO.IOException)
                    {
                    }
                }
                break;

            case OtpMsg.Tag.demonitorPTag:
            case OtpMsg.Tag.monitorPexitTag:
                monitors.Remove(msg.getSenderPid());
                break;

            case OtpMsg.Tag.unlinkTag:
            case OtpMsg.Tag.exitTag:
                links.removeLink(msg.getRecipientPid(), msg.getSenderPid());
                break;

            case OtpMsg.Tag.exit2Tag:
                break;
            }
            return;
        }
Exemplo n.º 3
0
        /*
         * OtpCookedConnection delivers messages here
         * return true if message was delivered successfully, or false otherwise.
         */
        internal virtual bool deliver(OtpMsg m)
        {
            OtpMbox mbox = null;

            try
            {
                OtpMsg.Tag t = m.type();

                if (t == OtpMsg.Tag.regSendTag)
                {
                    System.String name = m.getRecipientName();
                    /*special case for netKernel requests */
                    if (name.Equals("net_kernel"))
                    {
                        return(netKernel(m));
                    }
                    else
                    {
                        mbox = mboxes.get(name);
                    }
                }
                else
                {
                    mbox = mboxes.get(m.getRecipientPid());
                }
                if (mbox == null)
                {
                    return(false);
                }
                mbox.deliver(m);
            }
            catch (System.Exception)
            {
                return(false);
            }

            return(true);
        }
Exemplo n.º 4
0
        /*
        * called by OtpNode to deliver message to this mailbox.
        *
        * About exit and exit2: both cause exception to be raised upon
        * receive(). However exit (not 2) causes any link to be removed as
        * well, while exit2 leaves any links intact.
        */
        internal virtual void deliver(OtpMsg m)
        {
            switch (m.type())
            {
                case OtpMsg.linkTag:
                    links.addLink(_self, m.getSenderPid());
                    break;

                case OtpMsg.unlinkTag:
                    links.removeLink(_self, m.getSenderPid());
                    break;

                case OtpMsg.exitTag:
                    links.removeLink(_self, m.getSenderPid());
                    queue.put(m);
                    break;

                case OtpMsg.exit2Tag: default:
                    queue.put(m);
                    break;
            }
        }
Exemplo n.º 5
0
		/*
		* pass the message to the node for final delivery. Note that the
		* connection itself needs to know about links (in case of connection
		* failure), so we snoop for link/unlink too here.
		*/
		public override void  deliver(OtpMsg msg)
		{
			bool delivered = self.deliver(msg);

			switch (msg.type())
			{
				case OtpMsg.Tag.linkTag:
					if (delivered)
					{
						links.addLink(msg.getRecipientPid(), msg.getSenderPid());
					}
					else
						try
						{
							// no such pid - send exit to sender
							base.sendExit(msg.getRecipientPid(), msg.getSenderPid(), "noproc");
						}
						catch (System.IO.IOException)
						{
						}
					break;

                case OtpMsg.Tag.monitorPTag:
                    if (delivered)
                        monitors[msg.getSenderPid()] = msg.getMsg();
                    else
                        try
                        {
                            base.sendExit(msg.getRecipientPid(), msg.getSenderPid(), "noproc");
                        }
                        catch (System.IO.IOException)
                        {
                        }
                    break;

                case OtpMsg.Tag.demonitorPTag:
                case OtpMsg.Tag.monitorPexitTag:
                    monitors.Remove(msg.getSenderPid());
                    break;

                case OtpMsg.Tag.unlinkTag:
                case OtpMsg.Tag.exitTag:
					links.removeLink(msg.getRecipientPid(), msg.getSenderPid());
					break;

                case OtpMsg.Tag.exit2Tag:
					break;
			}
			return ;
		}
Exemplo n.º 6
0
		/*
		* OtpCookedConnection delivers messages here
		* return true if message was delivered successfully, or false otherwise.
		*/
		internal virtual bool deliver(OtpMsg m)
		{
			OtpMbox mbox = null;
			
			try
			{
                OtpMsg.Tag t = m.type();
				
				if (t == OtpMsg.Tag.regSendTag)
				{
					System.String name = m.getRecipientName();
					/*special case for netKernel requests */
					if (name.Equals("net_kernel"))
						return netKernel(m);
					else
						mbox = mboxes.get(name);
				}
				else
				{
					mbox = mboxes.get(m.getRecipientPid());
				}
				if (mbox == null)
					return false;
				mbox.deliver(m);
			}
			catch (System.Exception)
			{
				return false;
			}
			
			return true;
		}
Exemplo n.º 7
0
		/*
		* called by OtpNode to deliver message to this mailbox.
		*
		* About exit and exit2: both cause exception to be raised upon
		* receive(). However exit (not 2) causes any link to be removed as
		* well, while exit2 leaves any links intact.
		*/
		internal virtual void  deliver(OtpMsg m)
		{
			switch (m.type())
			{
                case OtpMsg.Tag.linkTag: 
					links.addLink(_self, m.getSenderPid());
					break;

                case OtpMsg.Tag.unlinkTag:
					links.removeLink(_self, m.getSenderPid());
					break;

                case OtpMsg.Tag.exitTag:
					links.removeLink(_self, m.getSenderPid());
					queue.put(m);
					break;

                case OtpMsg.Tag.monitorPTag:
                    monitors[m.getSenderPid()] = m.getMsg();
                    break;

                case OtpMsg.Tag.demonitorPTag:
                    monitors.Remove(m.getSenderPid());
                    break;

                case OtpMsg.Tag.monitorPexitTag:
                    queue.put(m);
                    break;

                case OtpMsg.Tag.exit2Tag:
                default:
					queue.put(m);
					break;
			}
		}