Ejemplo n.º 1
0
        /// <summary>
        /// Drops the current connection and reconnects, reusing all settings.
        /// </summary>
        /// <exception cref="ObjectDisposedException">Cannot reconnect, <see cref="BroConnection"/> is disposed.</exception>
        /// <exception cref="InvalidOperationException">Failed to reconnect to host.</exception>
        public void Reconnect()
        {
            if (m_connectionPtr.IsInvalid())
            {
                throw new ObjectDisposedException("Cannot reconnect, Bro connection is disposed.");
            }

            // Attempt reconnection
            if (BroApi.bro_conn_reconnect(m_connectionPtr) == 0)
            {
                throw new InvalidOperationException(string.Format("Failed to reconnect to \"{0}\".", m_hostName));
            }
        }