Пример #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
        /// <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
 /// <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);
 }