Example #1
0
        public HTSConnectionAsync(HTSConnectionListener listener, String clientName, String clientVersion, ILogger logger)
        {
            _logger = logger;

            _connected = false;
            _lock      = new object();

            _listener      = listener;
            _clientName    = clientName;
            _clientVersion = clientVersion;

            _buffer = new ByteList();
            _receivedMessagesQueue = new SizeQueue <HTSMessage>(int.MaxValue);
            _messagesForSendQueue  = new SizeQueue <HTSMessage>(int.MaxValue);
            _responseHandlers      = new Dictionary <int, HTSResponseHandler>();
        }
        public HTSConnectionAsync(HTSConnectionListener listener, String clientName, String clientVersion, ILogger logger)
        {
            _logger = logger;

            _connected = false;
            _lock = new object();

            _listener = listener;
            _clientName = clientName;
            _clientVersion = clientVersion;

            _buffer = new ByteList();
            _receivedMessagesQueue = new SizeQueue<HTSMessage>(int.MaxValue);
            _messagesForSendQueue = new SizeQueue<HTSMessage>(int.MaxValue);
            _responseHandlers = new Dictionary<int, HTSResponseHandler>();
        }
        public HTSConnectionAsync(HTSConnectionListener listener, String clientName, String clientVersion, ILogger <LiveTvService> logger)
        {
            _logger = logger;

            _connected = false;
            _lock      = new object();

            _listener      = listener;
            _clientName    = clientName;
            _clientVersion = clientVersion;

            _buffer = new ByteList();
            _receivedMessagesQueue = new SizeQueue <HTSMessage>(int.MaxValue);
            _messagesForSendQueue  = new SizeQueue <HTSMessage>(int.MaxValue);
            _responseHandlers      = new Dictionary <int, HTSResponseHandler>();

            _receiveHandlerThreadTokenSource     = new CancellationTokenSource();
            _messageBuilderThreadTokenSource     = new CancellationTokenSource();
            _sendingHandlerThreadTokenSource     = new CancellationTokenSource();
            _messageDistributorThreadTokenSource = new CancellationTokenSource();
        }
Example #4
0
    static void Main()
    {
        Thread.CurrentThread.Name = "Reader";
        Thread writer = new Thread(WriterLoop);

        writer.Name = "Writer";
        var queue = new SizeQueue <int>(100);

        writer.Start(queue);
        // reader loop - note this can run parallel
        // to the writer
        for (int i = 0; i < 100; i++)
        {
            if (i % 10 == 9)
            {
                Write(i);
            }
            queue.Enqueue(i);
            Thread.Sleep(5);     // pretend it takes time
        }
        queue.Close();
        Write("exiting");
    }
 public LoopBackResponseHandler()
 {
     _responseDataQueue = new SizeQueue <HTSMessage>(1);
 }
Example #6
0
 /**
  * <p>Constructor for AbstractActionFuture.</p>
  *
  * @param proxyListener a {@link iqq.im.QQActionListener.OnActionEvent} object.
  */
 public AbstractActionFuture(QQActionListener.OnActionEvent proxyListener)
 {
     this.proxyListener = proxyListener;
     this.evtQueue      = new SizeQueue <QQActionEvent>(int.MaxValue);
 }
 public LoopBackResponseHandler()
 {
     _responseDataQueue = new SizeQueue<HTSMessage>(1);
 }