X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/747017e39d73c3948c988b0d0cf6f1a18e25c4b3..38da2fa514bbfb11197fa17ecb1cde480bb9e2cc:/projects/sgauth/main.cpp?ds=inline diff --git a/projects/sgauth/main.cpp b/projects/sgauth/main.cpp index b19ff6ed..cdda3cb9 100644 --- a/projects/sgauth/main.cpp +++ b/projects/sgauth/main.cpp @@ -105,6 +105,14 @@ private: }; //----------------------------------------------------------------------------- SETTINGS::SETTINGS() + : port(0), + localPort(0), + listenWebIP(0), + refreshPeriod(0), + daemon(false), + noWeb(false), + reconnect(false), + showPid(false) { confFile = "/etc/sgauth.conf"; } @@ -352,7 +360,7 @@ if (clnp->GetAuthorized()) { cout << "Connect" << endl; clnp->Connect(); - } + } } //----------------------------------------------------------------------------- void CatchUSR2(int) @@ -408,9 +416,6 @@ return; //----------------------------------------------------------------------------- int main(int argc, char *argv[]) { -//int port; -//char *endptr; - SETTINGS settings; #ifndef WIN32 @@ -420,13 +425,6 @@ if(0) #endif { settings.SetConfFile(argv[1]); - if (settings.ReadSettings()) - { - printf("ReadSettingsError\n"); - printf("%s\n", settings.GetStrError().c_str()); - exit(-1); - } - settings.Print(); } else { @@ -449,7 +447,13 @@ else }*/ } -//settings.Print(); +if (settings.ReadSettings()) + { + printf("ReadSettingsError\n"); + printf("%s\n", settings.GetStrError().c_str()); + exit(-1); + } +settings.Print(); #ifndef WIN32 if (settings.GetDaemon()) @@ -460,22 +464,19 @@ if (settings.GetDaemon()) switch (fork()) { - case -1: // ìÁÖÁ + case -1: exit(1); break; - case 0: // ðÏÔÏÍÏË + case 0: setsid(); break; - default: // ïÓÎÏ×ÎÏÊ ÐÒÏÃÅÓÓ + default: exit(0); break; } } - - - #endif clnp = new IA_CLIENT_PROT(settings.GetServerName(), settings.GetServerPort(), settings.GetLocalPort()); @@ -498,7 +499,6 @@ clnp->SetDirNameCb(SetDirName, NULL); clnp->SetStatChangedCb(StatUpdate, NULL); clnp->SetReconnect(settings.GetReconnect()); - clnp->Start(); SetSignalHandlers(); @@ -560,5 +560,3 @@ while (1) return 0; } //----------------------------------------------------------------------------- - -