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

void CCore::InitializeAdditionalListeners ( void   )  [private]

InitializeAdditionalListeners

Initialized the additional listeners.

Definition at line 2293 of file Core.cpp.

References AddAdditionalListener(), Fatal(), m_Config, m_LoadingListeners, and CConfig::ReadString().

Referenced by StartMainLoop().

                                              {
      unsigned short Port;
      bool SSL;
      unsigned int i;
      char *Out;

      m_LoadingListeners = true;

      i = 0;
      while (true) {
            asprintf(&Out, "system.listeners.listener%d", i++);

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

            const char *ListenerString = m_Config->ReadString(Out);

            free(Out);

            if (ListenerString != NULL) {
                  const char *ListenerToks = ArgTokenize(ListenerString);
                  const char *PortString = ArgGet(ListenerToks, 1);
                  const char *SSLString = ArgGet(ListenerToks, 2);
                  const char *Address = NULL;

                  SSL = false;

                  if (ArgCount(ListenerToks) > 0) {
                        Port = atoi(PortString);

                        if (ArgCount(ListenerToks) > 1) {
                              SSL = (atoi(SSLString) != 0);

                              if (ArgCount(ListenerToks) > 2) {
                                    Address = ArgGet(ListenerToks, 3);
                              }
                        }
                  }

                  AddAdditionalListener(Port, Address, SSL);
            } else {
                  break;
            }
      }

      m_LoadingListeners = false;
}


Generated by  Doxygen 1.6.0   Back to index