deliver() 개인적인 메소드

private deliver ( OtpMsg m ) : bool
m OtpMsg
리턴 bool
예제 #1
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;
        }
예제 #2
0
파일: OtpMbox.cs 프로젝트: trompa/jungerl
 /*
  * Send a message to a remote {@link Pid pid}, representing
  * either another {@link OtpMbox mailbox} or an Erlang process.
  *
  * @param to the {@link Pid pid} identifying the intended
  * recipient of the message.
  *
  * @param msg the body of the message to send.
  *
  **/
 public void send(Erlang.Pid to, Erlang.Object msg)
 {
     try
     {
         System.String node = to.node();
         if (node.Equals(home.node()))
         {
             home.deliver(new OtpMsg(to, (Erlang.Object)(msg.clone())));
         }
         else
         {
             OtpCookedConnection conn = home.connection(node);
             if (conn == null)
             {
                 return;
             }
             conn.send(_self, to, msg);
         }
     }
     catch (System.Exception)
     {
     }
 }