コード例 #1
0
        /// <summary>
        /// Write the given Msg to the pipe.
        /// </summary>
        /// <param name="msg">the Msg to push to the pipe</param>
        /// <returns>true if the Msg was successfully sent</returns>
        public virtual PushMsgResult PushMsg(ref Msg msg)
        {
            if (msg.HasCommand)
            {
                return(PushMsgResult.Ok);
            }

            if (m_pipe != null && m_pipe.Write(ref msg))
            {
                msg.InitEmpty();
                return(PushMsgResult.Ok);
            }

            return(PushMsgResult.Full);
        }
コード例 #2
0
        /// <summary>
        /// Write the given Msg to the pipe.
        /// </summary>
        /// <param name="msg">the Msg to push to the pipe</param>
        /// <returns>true if the Msg was successfully sent</returns>
        public virtual bool PushMsg(ref Msg msg)
        {
            // First message to receive is identity (if required).
            if (!m_identityReceived)
            {
                msg.SetFlags(MsgFlags.Identity);
                m_identityReceived = true;

                if (!m_options.RecvIdentity)
                {
                    msg.Close();
                    msg.InitEmpty();
                    return(true);
                }
            }

            if (m_pipe != null && m_pipe.Write(ref msg))
            {
                msg.InitEmpty();
                return(true);
            }

            return(false);
        }