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);
}