예제 #1
0
 /// <summary>
 /// Close the given mailbox
 /// </summary>
 public void CloseMbox(ErlMbox mbox)
 {
     if (m_Mailboxes != null)
     {
         m_Mailboxes.Unregister(mbox);
     }
 }
예제 #2
0
        /// <summary>
        /// Determine if two mailboxes are equal
        /// </summary>
        public override bool Equals(object o)
        {
            if (!(o is ErlMbox))
            {
                return(false);
            }

            ErlMbox m = (ErlMbox)o;

            return(m.m_Self.Equals(m_Self));
        }
예제 #3
0
        internal ErlCRUDSubscription(ErlDataStore store,
            string name,
            Query query,
            Mailbox recipient,
            object correlate = null
            )
            : base(store, name, query, recipient, correlate)
        {
            m_ErlBox = store.MakeMailbox();
               m_Queue  = new ConcurrentQueue<IQueable>();

               m_ErlBox.MailboxMessage += (_, msg) =>
                                  {
                                    m_Queue.Enqueue(msg);
                                    asyncProcess();
                                    return true;
                                  };

               m_Store = store;
               m_Query = query;
               subscribeCore();
               HasLoaded();
        }
예제 #4
0
파일: ErlLocalNode.cs 프로젝트: mjaric/nfx
        /// <summary>
        /// Start current node. This optionally creates a socket listener
        /// and I/O server
        /// </summary>
        protected override void DoStart()
        {
            m_Connections = new ConcurrentDictionary <ErlAtom, ErlConnection>();
            m_Mailboxes   = new Internal.MboxRegistry(this);

            //bool acceptConnections = true, short port = 0, IPAddress addr = null
            if (m_IoServer != null)
            {
                throw new ErlException("Already started!");
            }

            m_GroupLeader = m_Mailboxes.Create(ConstAtoms.User);

            if (m_AcceptConnections)
            {
                var addr = m_AcceptAddressPort.IsNullOrEmpty()
                             ? new IPEndPoint(0, 0) : m_AcceptAddressPort.ToIPEndPoint();

                m_Acceptor = new Internal.ErlAcceptor(this, addr.Port, addr.Address);
            }

            m_IoServer  = new Internal.ErlIoServer(this);
            m_RpcServer = new Internal.ErlRpcServer(this);
        }
예제 #5
0
파일: ErlLocalNode.cs 프로젝트: mjaric/nfx
 /// <summary>
 /// Close the given mailbox
 /// </summary>
 public void CloseMbox(ErlMbox mbox)
 {
     m_Mailboxes.Unregister(mbox);
 }
예제 #6
0
            /// <summary>
            /// Start current node. This optionally creates a socket listener
            /// and I/O server
            /// </summary>
            protected override void DoStart()
            {
                m_Connections = new ConcurrentDictionary<ErlAtom, ErlConnection>();
                m_Mailboxes = new Internal.MboxRegistry(this);

                //bool acceptConnections = true, short port = 0, IPAddress addr = null
                if (m_IoServer != null)
                    throw new ErlException("Already started!");

                m_GroupLeader = m_Mailboxes.Create(ConstAtoms.User);

                if (m_AcceptConnections)
                {
                    var addr = m_AcceptAddressPort.IsNullOrEmpty()
                             ? new IPEndPoint(0, 0) : m_AcceptAddressPort.ToIPEndPoint();

                    m_Acceptor = new Internal.ErlAcceptor(this, addr.Port, addr.Address);
                }

                m_IoServer  = new Internal.ErlIoServer(this);
                m_RpcServer = new Internal.ErlRpcServer(this);
            }
예제 #7
0
 /// <summary>
 /// Wait for arrival of messages in any one of the given mailboxes
 /// </summary>
 /// <param name="mboxes">Mailboxes to wait for messages in</param>
 /// <param name="msecTimeout">Timeout in milliseconds</param>
 /// <returns>Index of the first non-empty mailbox or -1 on timeout</returns>
 public int WaitAny(ErlMbox[] mboxes, int msecTimeout = -1)
 {
     for(int i = 0; i < mboxes.Length; i++)
         if (!mboxes[i].Empty)
             return i;
     if (msecTimeout == 0)
         return -1;
     int n = WaitHandle.WaitAny(mboxes.Select(m => m.Handle).ToArray(), msecTimeout);
     return n == WaitHandle.WaitTimeout ? -1 : n;
 }
예제 #8
0
 /// <summary>
 /// Close the given mailbox
 /// </summary>
 public void CloseMbox(ErlMbox mbox)
 {
     m_Mailboxes.Unregister(mbox);
 }
 public ErlCRUDQueryExecutionContext(ErlDataStore store, ErlMbox erlMBox = null)
 {
   this.DataStore = store;
   ErlMailBox = erlMBox;
 }
예제 #10
0
 public ErlCRUDQueryExecutionContext(ErlDataStore store, ErlMbox erlMBox = null, DataTimeStamp? ts = null)
 {
     this.DataStore = store;
       ErlMailBox = erlMBox;
       SubscriptionTimestamp = ts;
 }
예제 #11
0
 /// <summary>
 /// Close the given mailbox
 /// </summary>
 public void CloseMbox(ErlMbox mbox)
 {
     if (m_Mailboxes != null)
     m_Mailboxes.Unregister(mbox);
 }