protected override bool XRecv(SendReceiveOptions flags, out Msg msg) { // If there's already a message prepared by a previous call to zmq_poll, // return it straight ahead. if (m_hasMessage) { msg = new Msg(m_message); m_hasMessage = false; m_more = msg.HasMore; return(true); } // TODO: This can result in infinite loop in the case of continuous // stream of non-matching messages which breaks the non-blocking recv // semantics. while (true) { // Get a message using fair queueing algorithm. bool isMessageAvailable = m_fq.Recv(out msg); // If there's no message available, return immediately. // The same when error occurs. if (!isMessageAvailable) { return(false); } else if (msg == null) { return(true); } // Check whether the message matches at least one subscription. // Non-initial parts of the message are passed if (m_more || !m_options.Filter || Match(msg)) { m_more = msg.HasMore; return(true); } // Message doesn't match. Pop any remaining parts of the message // from the pipe. while (msg.HasMore) { m_fq.Recv(out msg); Debug.Assert(msg != null); } } }
private bool xxrecv(SendReceiveOptions flags, ref Msg msg) { // If there is a prefetched message, return it. if (m_prefetched) { msg.Move(ref m_prefetchedMsg); m_prefetched = false; return(true); } // DEALER socket doesn't use identities. We can safely drop it and while (true) { bool isMessageAvailable = m_fq.Recv(ref msg); if (!isMessageAvailable) { return(false); } if ((msg.Flags & MsgFlags.Identity) == 0) { break; } } return(true); }
private bool xxrecv(SendReceiveOptions flags_, out Msg msg_) { msg_ = null; // If there is a prefetched message, return it. if (m_prefetched) { msg_ = m_prefetchedMsg; m_prefetched = false; m_prefetchedMsg = null; return(true); } // DEALER socket doesn't use identities. We can safely drop it and while (true) { bool isMessageAvailable = m_fq.Recv(out msg_); if (!isMessageAvailable) { return(false); } else if (msg_ == null) { return(true); } if ((msg_.Flags & MsgFlags.Identity) == 0) { break; } } return(true); }
protected bool XRecv(SendReceiveOptions flags, out Msg msg) { return(m_fq.Recv(out msg)); }
override protected bool XRecv(SendReceiveOptions flags, ref Msg msg) { return(m_fq.Recv(ref msg)); }