//internal RQInteraction Dequeue() //{ // return m_queue.Dequeue(); //} internal virtual void Enqueue(RQInteraction rqi) { lock (this.padlock) { if (m_queue.Count == 0) { waitingSinceTicks = DateTime.Now.Ticks; } m_queue.Enqueue(rqi); } }
// the queue allows only the last command exist in the waiting, if a new one comes it becomes the waiting one. internal override void Enqueue(RQInteraction rqi) { lock (this.padlock) { if (m_queue.Count > 0) { //Tracer.Trace(Name + " - skipped one"); m_queue.Clear(); } m_queue.Enqueue(rqi); } }
internal bool checkForTimeout() { bool ret = false; if (isProcessingInteraction && (DateTime.Now.Ticks - m_currentInteraction.whenSentTicks) / TimeSpan.TicksPerMillisecond > m_currentInteraction.timeoutMs) { Tracer.Error("RoboteQ timeout on " + m_currentInteraction.toSend); m_currentInteraction = null; ret = true; } return(ret); }
internal bool checkForTimeout() { bool ret = false; if (isProcessingInteraction && (DateTime.Now.Ticks - m_currentInteraction.whenSentTicks) / TimeSpan.TicksPerMillisecond > m_currentInteraction.timeoutMs) { Tracer.Error("RoboteQ timeout on " + m_currentInteraction.toSend); m_currentInteraction = null; ret = true; } return ret; }
internal bool onStringReceived(string str, long timestamp) // may throw an exception { bool ret = false; lock (this.padlock) { if (m_currentInteraction != null) { m_currentInteraction.received.Add(str); if (m_currentInteraction.received.Count >= m_currentInteraction.linesToExpect) { // last line of the response m_currentInteraction.interpretResponse(timestamp); m_currentInteraction = null; ret = true; } } } return(ret); }
internal string dequeueForSend() { m_currentInteraction = m_queue.Dequeue(); m_currentInteraction.whenSentTicks = DateTime.Now.Ticks; return(m_currentInteraction.toSend); }
internal string dequeueForSend() { m_currentInteraction = m_queue.Dequeue(); m_currentInteraction.whenSentTicks = DateTime.Now.Ticks; return m_currentInteraction.toSend; }
// may throw an exception internal bool onStringReceived(string str, long timestamp) { bool ret = false; lock (this.padlock) { if (m_currentInteraction != null) { m_currentInteraction.received.Add(str); if (m_currentInteraction.received.Count >= m_currentInteraction.linesToExpect) { // last line of the response m_currentInteraction.interpretResponse(timestamp); m_currentInteraction = null; ret = true; } } } return ret; }