Beispiel #1
0
        public void InEvent()
        {
            Socket fd;

            try
            {
                fd = Accept();
            }
            catch (Exception)
            {
                //  If connection was reset by the peer in the meantime, just ignore it.
                //  TODO: Handle specific errors like ENFILE/EMFILE etc.
                //ZError.exc (e);
                m_socket.EventAcceptFailed(m_address.ToString(), ZError.ErrorNumber);
                return;
            }

            PgmSocket pgmSocket = new PgmSocket(m_options, PgmSocketType.Receiver, m_address);
            pgmSocket.Init(fd);

            PgmSession pgmSession = new PgmSession(pgmSocket, m_options);

            IOThread ioThread = ChooseIOThread(m_options.Affinity);

            SessionBase session = SessionBase.Create(ioThread, false, m_socket,
                                                                                             m_options, new Address(m_handle.LocalEndPoint));
            session.IncSeqnum();
            LaunchChild(session);
            SendAttach(session, pgmSession, false);
            m_socket.EventAccepted(m_address.ToString(), fd);
        }
Beispiel #2
0
        public void InEvent()
        {
            Socket fd;

            try
            {
                fd = Accept();
            }
            catch (SocketException ex)
            {
                m_socket.EventAcceptFailed(m_address.ToString(), ErrorHelper.SocketErrorToErrorCode(ex.SocketErrorCode));
                return;
            }
            catch (NetMQException ex)
            {
                //  If connection was reset by the peer in the meantime, just ignore it.
                //  TODO: Handle specific errors like ENFILE/EMFILE etc.
                //ZError.exc (e);
                m_socket.EventAcceptFailed(m_address.ToString(), ex.ErrorCode);
                return;
            }

            PgmSocket pgmSocket = new PgmSocket(m_options, PgmSocketType.Receiver, m_address);

            pgmSocket.Init(fd);

            PgmSession pgmSession = new PgmSession(pgmSocket, m_options);

            IOThread ioThread = ChooseIOThread(m_options.Affinity);

            SessionBase session = SessionBase.Create(ioThread, false, m_socket,
                                                     m_options, new Address(m_handle.LocalEndPoint));

            session.IncSeqnum();
            LaunchChild(session);
            SendAttach(session, pgmSession, false);
            m_socket.EventAccepted(m_address.ToString(), fd);
        }