Пример #1
0
        /// <summary>
        /// Send an RPC cast request to the remote Erlang node
        /// </summary>
        public void SendRPCcast(ErlPid from, string mod, string fun, ErlList args)
        {
            IErlObject rpc = Internal.ErlRpcServer.EncodeRPCcast(from, mod, fun, args, ConstAtoms.User);
            var        msg = ErlMsg.RegSend(from, ConstAtoms.Rex, rpc);

            Send(msg);
        }
Пример #2
0
 /// <summary>
 /// Link to a remote mailbox or Erlang process. Links are
 /// idempotent, calling this method multiple times will not result in
 /// more than one link being created
 /// </summary>
 /// <remarks>
 /// If the remote process subsequently exits or the mailbox is
 /// closed, a subsequent attempt to retrieve a message through this
 /// mailbox will cause an {@link Exit Exit}
 /// exception to be raised. Similarly, if the sending mailbox is
 /// closed, the linked mailbox or process will receive an exit
 /// signal.
 ///
 /// If the remote process cannot be reached in order to set the
 /// link, the exception is raised immediately.
 /// </remarks>
 public void Link(ErlPid to)
 {
     Debug.Assert(to != m_Self);
     if (m_Node.Deliver(ErlMsg.Link(m_Self, to)))
     {
         m_Links.Add(to);
     }
 }
Пример #3
0
 /// <summary>
 /// Write an Erlang PID to the stream
 /// </summary>
 public void WritePid(ErlPid pid)
 {
     Debug.Assert(pid != ErlPid.Null);
     write(ErlExternalTag.Pid);
     WriteAtom(pid.Node);
     Write4BE(pid.Id & 0x7fff);          // 15 bits
     Write4BE(pid.Serial & 0x1fff);      // 13 bits
     Write1((byte)(pid.Creation & 0x3)); // 2 bits
 }
Пример #4
0
 internal ErlMbox(ErlLocalNode home, ErlPid self, ErlAtom name)
 {
     m_Self     = self;
     m_Node     = home;
     m_RegName  = name;
     m_Queue    = new ErlBlockingQueue <IQueable>();
     m_Links    = new ErlLinks();
     m_Monitors = new ErlMonitors(this);
 }
Пример #5
0
 /// <summary>
 /// Send a message to a remote <see cref="ErlPid"/>, representing
 /// either another <see cref="ErlMbox"/> or an Erlang process
 /// </summary>
 /// <returns>true if message was sent successfully</returns>
 public bool Send(ErlPid to, IErlObject msg)
 {
     return(Deliver(ErlMsg.Send(to, msg)));
 }
Пример #6
0
 /// <summary>
 /// Send an Erlang term to a Pid on a local or remote node
 /// </summary>
 public void Send(ErlPid dest, IErlObject msg)
 {
     base.Send(ErlMsg.Send(dest, msg, SendCookie));
 }
Пример #7
0
 /*
  * send to remote name
  * dest is recipient's registered name, the nodename is implied by
  * the choice of connection.
  */
 public void Send(ErlPid from, ErlAtom dest, IErlObject msg)
 {
     // encode and send the message
     base.Send(ErlMsg.RegSend(from, dest, msg, SendCookie));
 }
Пример #8
0
 internal static ErlMsg Exit2TT(ErlPid from, ErlPid dest, IErlObject reason, ErlTrace traceToken)
 {
     return(new ErlMsg(Tag.Exit2TT, from, dest, reason: reason, trace: traceToken));
 }
Пример #9
0
 public ErlDown(ErlRef eref, ErlPid pid, IErlObject reason)
     : base(pid, reason)
 {
     Ref = eref;
 }
Пример #10
0
 internal static ErlMsg DemonitorP(ErlPid from, IErlObject /* Pid or Atom */ dest, ErlRef eref)
 {
     return(new ErlMsg(Tag.DemonitorP, from, dest, eref: eref));
 }
Пример #11
0
 internal static ErlMsg Send(ErlPid dest, IErlObject msg, ErlAtom?cookie = null)
 {
     return(new ErlMsg(Tag.Send, ErlPid.Null, dest, payload: msg, cookie: cookie));
 }
Пример #12
0
 public ErlLink(ErlPid remote)
 {
     Node = remote.Node;
     Pid  = remote;
 }
Пример #13
0
 public void AsyncRPC(ErlAtom node, string mod, string fun, ErlList args, ErlPid ioServer,
                      ErlAtom?remoteCookie = null)
 {
     AsyncRPC(node, new ErlAtom(mod), new ErlAtom(fun), args, (IErlObject)ioServer, remoteCookie);
 }
Пример #14
0
 public bool Remove(ErlPid to)
 {
     return(Remove(new ErlLink(to)));
 }
Пример #15
0
 public ErlLink(ErlAtom remoteNode)
 {
     Node = remoteNode;
     Pid  = ErlPid.Null;
 }
Пример #16
0
 public bool Add(ErlPid to)
 {
     return(Add(new ErlLink(to)));
 }
Пример #17
0
 public bool Equals(ErlPid remote)
 {
     return(Pid.Equals(remote));
 }
Пример #18
0
 public void AsyncRPC(ErlAtom node, string mod, string fun, ErlList args, ErlPid ioServer)
 {
     AsyncRPC(node, new ErlAtom(mod), new ErlAtom(fun), args, (IErlObject)ioServer);
 }
Пример #19
0
 /// <summary>
 /// Send a message to a named mailbox on local node
 /// </summary>
 public bool Send(ErlPid from, ErlAtom toName, IErlObject msg)
 {
     return(Deliver(ErlMsg.RegSend(from, toName, msg)));
 }
Пример #20
0
 internal static ErlMsg MonitorPexit(IErlObject from, ErlPid dest, ErlRef eref, IErlObject reason)
 {
     return(new ErlMsg(Tag.MonitorPexit, from, dest, eref: eref, reason: reason));
 }
Пример #21
0
 /// <summary>
 /// Create an Erlang trace from the given arguments
 /// </summary>
 public ErlTrace(int flags, int label, int serial, ErlPid from, int prev)
     : base(flags, label, serial, from, prev)
 {
 }
Пример #22
0
 /// <summary>
 /// Create a mailbox with optional name
 /// </summary>
 internal ErlMbox(ErlLocalNode home, ErlPid self, string name = null)
     : this(home, self, name == null ? ErlAtom.Null : new ErlAtom(name))
 {
 }
Пример #23
0
 public bool Contains(ErlPid pid)
 {
     return(pid.Equals(Pid));
 }
Пример #24
0
        // All message types are described here:
        // http://www.erlang.org/doc/apps/erts/erl_dist_protocol.html#id91435

        internal static ErlMsg Link(ErlPid from, ErlPid dest)
        {
            return(new ErlMsg(Tag.Link, from, dest));
        }
Пример #25
0
 public void Down(ErlRef eref, ErlPid pid, ErlAtom reason)
 {
     // TODO
     throw new NotImplementedException();
 }
Пример #26
0
 public bool Equals(ErlPid remote)
 {
     return(remote.Equals(Pid));
 }
Пример #27
0
 /// <summary>
 /// Remove a link to a remote mailbox or Erlang process. This
 /// method removes a link created with <see cref="ErlLink"/>
 /// Links are idempotent; calling this method once will remove all
 /// links between this mailbox and the remote <see cref="ErlPid"/>
 /// </summary>
 public void Unlink(ErlPid to)
 {
     m_Links.Remove(to);
     m_Node.Deliver(ErlMsg.Unlink(m_Self, to));
 }
Пример #28
0
 public ErlExit(ErlPid pid, string reason) : this(pid, (IErlObject) new ErlString(reason))
 {
 }
Пример #29
0
 public ErlExit(ErlPid pid, IErlObject reason)
     : base(pid.Node, reason)
 {
     Pid = pid;
 }
Пример #30
0
 internal static ErlMsg RegSendTT(ErlPid from, ErlAtom dest, IErlObject msg,
                                  ErlTrace trace, ErlAtom?cookie = null)
 {
     return(new ErlMsg(Tag.RegSend, from, dest, payload: msg, cookie: cookie));
 }