예제 #1
0
 public GarbageRegistrationKey(EventListenerBase listener, IGarbageSink sink)
 {
     Listener = listener;
     Sink = sink;
 }
예제 #2
0
 public EventRegistrationKey(EventListenerBase listener, IEventSink sink)
 {
     Listener = listener;
     Sink = sink;
 }
예제 #3
0
            /// <summary>
            /// Starts the listener in multi-threaded mode. In this mode the listener
            /// consumes from 1 to 2 threads from the threadpool. A thread is used for
            /// receiving bytes and deserializing LWES events and another thread is 
            /// scheduled to perform event notification only when LWES events have
            /// been received.
            /// </summary>
            /// <param name="db">event template DB used during deserialization</param>
            /// <param name="listenEP">a IP endpoint where listening should occur</param>
            /// <param name="finishSocket"></param>
            /// <param name="listener"></param>
            public void Start(IEventTemplateDB db
                , IPEndPoint listenEP
                , Action<Socket, IPEndPoint> finishSocket
                , EventListenerBase listener)
            {
                this.TraceData(TraceEventType.Verbose, "EventListenerBase.BackgroundThreadListener - Starting");

                _db = db;
                _listener = listener;
                _anyEP = (listenEP.AddressFamily == AddressFamily.InterNetworkV6)
                    ? new IPEndPoint(IPAddress.IPv6Any, listenEP.Port)
                    : new IPEndPoint(IPAddress.Any, listenEP.Port);
                _buffer = BufferManager.AcquireBuffer(null);
                _listenEP = new UdpEndpoint(listenEP).Initialize(finishSocket);
                // Start a dedicated background thread to handle the receiving...
                _reciever = new Thread(Background_Receiver);
                _reciever.IsBackground = true;
                _reciever.Start();

                // Start a dedicated background thread to perform event notification...
                _notifierWaitObject = new Object();
                _notifier = new Thread(Background_Notifier);
                _notifier.IsBackground = true;
                _notifier.Start();

                this.TraceData(TraceEventType.Verbose, () =>
                {
                    return new object[] { String.Concat("EventListenerBase.BackgroundThreadListener - Started state: ", _recieverState.CurrentState) };
                });
            }
예제 #4
0
 public DataReceiverRegistrationKey(EventListenerBase listener, IDataReceiverSink sink)
 {
     Listener = listener;
     Sink = sink;
 }
예제 #5
0
            /// <summary>
            /// Starts the listener.
            /// </summary>
            /// <param name="db">an event template DB</param>
            /// <param name="listenEP">the listening endpoint</param>
            /// <param name="finishSocket">a callback method that is called upon to finish the listening socket</param>
            /// <param name="owner">the owner</param>
            public void Start(IEventTemplateDB db
                , IPEndPoint listenEP
                , Action<Socket, IPEndPoint> finishSocket
                , EventListenerBase owner)
            {
                this.TraceData(TraceEventType.Verbose, "EventListenerBase.ParallelListener - Starting");

                _db = db;
                _listener = owner;
                _anyEP = (listenEP.AddressFamily == AddressFamily.InterNetworkV6)
                    ? new IPEndPoint(IPAddress.IPv6Any, 0)
                    : new IPEndPoint(IPAddress.Any, 0);

                _receiveQueue = new SimpleLockFreeQueue<ReceiveCapture>();

                _listenEP = new UdpEndpoint(listenEP).Initialize(finishSocket);
                ParallelReceiver();
                this.TraceData(TraceEventType.Verbose, () =>
                {
                    return new object[] { String.Concat("EventListenerBase.ParallelListener - Started state: ", _listenerState.CurrentState) };
                });
            }