Beispiel #1
0
 protected override void ProcessPlug()
 {
     //  Start polling for incoming connections.
     m_ioObject.SetHandler(this);
     m_ioObject.AddFd(m_handle);
     m_ioObject.SetPollin(m_handle);
 }
Beispiel #2
0
        public void Plug(IOThread ioThread,
                         SessionBase session)
        {
            Debug.Assert(!m_plugged);
            m_plugged = true;

            //  Connect to session object.
            Debug.Assert(m_session == null);
            Debug.Assert(session != null);
            m_session = session;
            m_socket  = m_session.Socket;

            m_ioObject = new IOObject(null);
            m_ioObject.SetHandler(this);
            //  Connect to I/O threads poller object.
            m_ioObject.Plug(ioThread);
            m_ioObject.AddFd(m_handle);

            //  Send the 'length' and 'flags' fields of the identity message.
            //  The 'length' field is encoded in the long format.

            m_greetingOutputBuffer[m_outsize++] = ((byte)0xff);
            m_greetingOutputBuffer.PutLong(m_options.Endian, (long)m_options.IdentitySize + 1, 1);
            m_outsize += 8;
            m_greetingOutputBuffer[m_outsize++] = ((byte)0x7f);

            m_outpos = new ByteArraySegment(m_greetingOutputBuffer);

            m_ioObject.SetPollin(m_handle);
            m_ioObject.SetPollout(m_handle);

            //  Flush all the data that may have been already received downstream.
            InEvent();
        }
Beispiel #3
0
        //  Internal function to start the actual connection establishment.
        private void StartConnecting()
        {
            //  Open the connecting socket.

            try
            {
                Open();

                //  Connect may succeed in synchronous manner.
                m_handle = m_s;
                m_ioObject.AddFd(m_handle);
                m_handleValid = true;
                m_ioObject.OutEvent();
            }
            catch (NetMQException ex)
            {
                if (ex.ErrorCode == ErrorCode.EINPROGRESS)
                {
                    //  Connection establishment may be delayed. Poll for its completion.
                    m_handle = m_s;
                    m_ioObject.AddFd(m_handle);
                    m_handleValid = true;
                    m_ioObject.SetPollout(m_handle);
                    m_socket.EventConnectDelayed(m_endpoint, ex.ErrorCode);
                }
                else
                {
                    //  Handle any other error condition by eventual reconnect.
                    if (m_s != null)
                    {
                        Close();
                    }
                    AddReconnectTimer();
                }
            }
        }
Beispiel #4
0
        public void Plug(IOThread ioThread, SessionBase session)
        {
            m_session = session;

            m_socket = session.Socket;

            m_ioObject = new IOObject(null);
            m_ioObject.SetHandler(this);
            m_ioObject.Plug(ioThread);
            m_ioObject.AddFd(m_handle);
            m_ioObject.SetPollin(m_handle);

            DropSubscriptions();

            // push message to the session because there is no identity message with pgm
            session.PushMsg(new Msg());
        }
Beispiel #5
0
        public void Plug(IOThread ioThread,
		                 SessionBase session)
        {
            Debug.Assert(!m_plugged);
            m_plugged = true;

            //  Connect to session object.
            Debug.Assert(m_session == null);
            Debug.Assert(session != null);
            m_session = session;
            m_socket = m_session.Socket;

            m_ioObject = new IOObject(null);
            m_ioObject.SetHandler(this);
            //  Connect to I/O threads poller object.
            m_ioObject.Plug(ioThread);
            m_ioObject.AddFd(m_handle);

            //  Send the 'length' and 'flags' fields of the identity message.
            //  The 'length' field is encoded in the long format.

            m_greetingOutputBuffer[m_outsize++] = ((byte) 0xff);
            m_greetingOutputBuffer.PutLong((long) m_options.IdentitySize + 1, 1);
            m_outsize += 8;
            m_greetingOutputBuffer[m_outsize++] = ((byte) 0x7f);

            m_outpos = new ByteArraySegment(m_greetingOutputBuffer);

            m_ioObject.SetPollin(m_handle);
            m_ioObject.SetPollout(m_handle);

            //  Flush all the data that may have been already received downstream.
            InEvent();
        }
Beispiel #6
0
        public void Plug(IOThread ioThread, SessionBase session)
        {
            m_session = session;

            m_socket = session.Socket;

            m_ioObject = new IOObject(null);
            m_ioObject.SetHandler(this);
            m_ioObject.Plug(ioThread);
            m_ioObject.AddFd(m_handle);
            m_ioObject.SetPollin(m_handle);

            DropSubscriptions();

            // push message to the session because there is no identity message with pgm
            session.PushMsg(new Msg());
        }