NetMQ.Core.SessionBase.ProcessAttach C# (CSharp) Method

ProcessAttach() protected method

Process the Attach-request by hooking up the pipes and plugging in the given engine.
protected ProcessAttach ( IEngine engine ) : void
engine IEngine the IEngine to plug in
return void
        protected override void ProcessAttach(IEngine engine)
        {
            Debug.Assert(engine != null);

            // Create the pipe if it does not exist yet.
            if (m_pipe == null && !IsTerminating)
            {
                ZObject[] parents = { this, m_socket };
                int[] highWaterMarks = { m_options.ReceiveHighWatermark, m_options.SendHighWatermark };
                bool[] delays = { m_options.DelayOnClose, m_options.DelayOnDisconnect };
                Pipe[] pipes = Pipe.PipePair(parents, highWaterMarks, delays);

                // Plug the local end of the pipe.
                pipes[0].SetEventSink(this);

                // Remember the local end of the pipe.
                Debug.Assert(m_pipe == null);
                m_pipe = pipes[0];

                // Ask socket to plug into the remote end of the pipe.
                SendBind(m_socket, pipes[1]);
            }

            // Plug in the engine.
            Debug.Assert(m_engine == null);
            m_engine = engine;
            m_engine.Plug(m_ioThread, this);
        }