Exemple #1
0
        private void Detached()
        {
            //  Transient session self-destructs after peer disconnects.
            if (!m_connect)
            {
                Terminate();
                return;
            }

            //  For delayed connect situations, terminate the pipe
            //  and reestablish later on
            if (m_pipe != null && m_options.DelayAttachOnConnect &&
                m_addr.Protocol != Address.PgmProtocol && m_addr.Protocol != Address.EpgmProtocol)
            {
                m_pipe.Hiccup();
                m_pipe.Terminate(false);
                m_terminatingPipes.Add(m_pipe);
                m_pipe = null;
            }

            Reset();

            //  Reconnect.
            if (m_options.ReconnectIvl != -1)
            {
                StartConnecting(true);
            }

            //  For subscriber sockets we hiccup the inbound pipe, which will cause
            //  the socket object to resend all the subscriptions.
            if (m_pipe != null && (m_options.SocketType == ZmqSocketType.Sub || m_options.SocketType == ZmqSocketType.Xsub))
            {
                m_pipe.Hiccup();
            }
        }