Esempio n. 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);
        }
Esempio n. 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);
     }
 }
Esempio n. 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
 }
Esempio n. 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);
 }
Esempio n. 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)));
 }
Esempio n. 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));
 }
Esempio n. 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));
 }
Esempio n. 8
0
File: ErlMsg.cs Progetto: mjaric/nfx
 internal static ErlMsg Exit2TT(ErlPid from, ErlPid dest, IErlObject reason, ErlTrace traceToken)
 {
     return(new ErlMsg(Tag.Exit2TT, from, dest, reason: reason, trace: traceToken));
 }
Esempio n. 9
0
 public ErlDown(ErlRef eref, ErlPid pid, IErlObject reason)
     : base(pid, reason)
 {
     Ref = eref;
 }
Esempio n. 10
0
File: ErlMsg.cs Progetto: mjaric/nfx
 internal static ErlMsg DemonitorP(ErlPid from, IErlObject /* Pid or Atom */ dest, ErlRef eref)
 {
     return(new ErlMsg(Tag.DemonitorP, from, dest, eref: eref));
 }
Esempio n. 11
0
File: ErlMsg.cs Progetto: mjaric/nfx
 internal static ErlMsg Send(ErlPid dest, IErlObject msg, ErlAtom?cookie = null)
 {
     return(new ErlMsg(Tag.Send, ErlPid.Null, dest, payload: msg, cookie: cookie));
 }
Esempio n. 12
0
 public ErlLink(ErlPid remote)
 {
     Node = remote.Node;
     Pid  = remote;
 }
Esempio n. 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);
 }
Esempio n. 14
0
 public bool Remove(ErlPid to)
 {
     return(Remove(new ErlLink(to)));
 }
Esempio n. 15
0
 public ErlLink(ErlAtom remoteNode)
 {
     Node = remoteNode;
     Pid  = ErlPid.Null;
 }
Esempio n. 16
0
 public bool Add(ErlPid to)
 {
     return(Add(new ErlLink(to)));
 }
Esempio n. 17
0
 public bool Equals(ErlPid remote)
 {
     return(Pid.Equals(remote));
 }
Esempio n. 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);
 }
Esempio n. 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)));
 }
Esempio n. 20
0
File: ErlMsg.cs Progetto: mjaric/nfx
 internal static ErlMsg MonitorPexit(IErlObject from, ErlPid dest, ErlRef eref, IErlObject reason)
 {
     return(new ErlMsg(Tag.MonitorPexit, from, dest, eref: eref, reason: reason));
 }
Esempio n. 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)
 {
 }
Esempio n. 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))
 {
 }
Esempio n. 23
0
 public bool Contains(ErlPid pid)
 {
     return(pid.Equals(Pid));
 }
Esempio n. 24
0
File: ErlMsg.cs Progetto: mjaric/nfx
        // 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));
        }
Esempio n. 25
0
 public void Down(ErlRef eref, ErlPid pid, ErlAtom reason)
 {
     // TODO
     throw new NotImplementedException();
 }
Esempio n. 26
0
 public bool Equals(ErlPid remote)
 {
     return(remote.Equals(Pid));
 }
Esempio n. 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));
 }
Esempio n. 28
0
 public ErlExit(ErlPid pid, string reason) : this(pid, (IErlObject) new ErlString(reason))
 {
 }
Esempio n. 29
0
 public ErlExit(ErlPid pid, IErlObject reason)
     : base(pid.Node, reason)
 {
     Pid = pid;
 }
Esempio n. 30
0
File: ErlMsg.cs Progetto: mjaric/nfx
 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));
 }