Logo Search packages:      
Sourcecode: sbnc version File versions  Download package

void CCore::UpdateAdditionalListeners ( void   )  [private]

UpdateAdditionalListeners

Updates the list of additional listeners in the bouncer's main config file.

Definition at line 2369 of file Core.cpp.

References Fatal(), m_AdditionalListeners, m_Config, m_LoadingListeners, and CConfig::WriteString().

Referenced by AddAdditionalListener(), and RemoveAdditionalListener().

                                          {
      char *Out, *Value;
      int a = 0;

      if (m_LoadingListeners) {
            return;
      }

      for (unsigned int i = 0; i < m_AdditionalListeners.GetLength(); i++) {
            asprintf(&Out, "system.listeners.listener%d", a++);

            CHECK_ALLOC_RESULT(Out, asprintf) {
                  Fatal();
            } CHECK_ALLOC_RESULT_END;

            if (m_AdditionalListeners[i].BindAddress != NULL) {
                  asprintf(&Value, "%d %d %s", m_AdditionalListeners[i].Port, m_AdditionalListeners[i].SSL, m_AdditionalListeners[i].BindAddress);
            } else {
                  asprintf(&Value, "%d %d", m_AdditionalListeners[i].Port, m_AdditionalListeners[i].SSL);
            }

            CHECK_ALLOC_RESULT(Value, asprintf) {
                  Fatal();
            } CHECK_ALLOC_RESULT_END;

            m_Config->WriteString(Out, Value);

            free(Out);
      }

      asprintf(&Out, "system.listeners.listener%d", a);

      CHECK_ALLOC_RESULT(Out, asprintf) {
            Fatal();
      } CHECK_ALLOC_RESULT_END;

      m_Config->WriteString(Out, NULL);

      free(Out);
}


Generated by  Doxygen 1.6.0   Back to index