]> git.stg.codes - stg.git/blob - projects/stargazer/main.cpp
Добавление исходников
[stg.git] / projects / stargazer / main.cpp
1 /*
2  *    This program is free software; you can redistribute it and/or modify
3  *    it under the terms of the GNU General Public License as published by
4  *    the Free Software Foundation; either version 2 of the License, or
5  *    (at your option) any later version.
6  *
7  *    This program is distributed in the hope that it will be useful,
8  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
9  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10  *    GNU General Public License for more details.
11  *
12  *    You should have received a copy of the GNU General Public License
13  *    along with this program; if not, write to the Free Software
14  *    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
15  */
16
17 /*
18  *    Author : Boris Mikhailenko <stg34@stargazer.dp.ua>
19  */
20
21  /*
22  $Revision: 1.124 $
23  $Date: 2010/10/04 20:19:12 $
24  $Author: faust $
25  */
26
27 #include <stdio.h>
28 #include <sys/types.h>
29 #include <sys/socket.h>
30 #include <netinet/in.h>
31 #include <arpa/inet.h>
32 #include <unistd.h>
33 #include <sys/ipc.h>
34 #include <sys/msg.h>
35 #include <sys/stat.h>
36 #include <sys/wait.h>
37 #include <dlfcn.h>
38 #include <signal.h>
39 #include <fcntl.h>
40
41 #include <fstream>
42 #include <vector>
43 #include <set>
44 #include <list>
45
46 #include "settings.h"
47 #include "user.h"
48 #include "users.h"
49 #include "admins.h"
50 #include "common.h"
51 #include "traffcounter.h"
52 #include "base_plugin.h"
53 #include "stg_logger.h"
54 #include "stg_timer.h"
55 #include "plugin_runner.h"
56 #include "script_executer.h"
57 #include "conffiles.h"
58 #include "version.h"
59 #include "store_loader.h"
60 #include "pidfile.h"
61 #include "eventloop.h"
62
63 using namespace std;
64 uint32_t        eip;
65
66 #ifdef DEBUG
67     #define MAIN_DEBUG (1)
68     #define NO_DAEMON  (1)
69 #endif
70
71 #define START_FILE "/._ST_ART_ED_"
72
73 static bool needRulesReloading = false;
74 static bool childExited = false;
75 //static pid_t executerPid;
76 set<pid_t> executersPid;
77 static pid_t stgChildPid;
78
79 #include "pinger.h"
80
81 //-----------------------------------------------------------------------------
82 bool StartModCmp(const PLUGIN_RUNNER & lhs, const PLUGIN_RUNNER & rhs)
83 {
84 return lhs.GetStartPosition() < rhs.GetStartPosition();
85 }
86 //-----------------------------------------------------------------------------
87 bool StopModCmp(const PLUGIN_RUNNER & lhs, const PLUGIN_RUNNER & rhs)
88 {
89 return lhs.GetStopPosition() > rhs.GetStopPosition();
90 }
91 //-----------------------------------------------------------------------------
92 class STG_STOPPER
93 {
94 public:
95     STG_STOPPER() { nonstop = true; }
96     bool    GetStatus() { return nonstop; };
97     #ifdef NO_DAEMON
98     void    Stop(const char * __file__, int __line__)
99     #else
100     void    Stop(const char *, int)
101     #endif
102         {
103         #ifdef NO_DAEMON
104         printfd(__FILE__, "Stg stopped at %s:%d\n", __file__, __line__);
105         #endif
106         nonstop = false;
107         }
108 private:
109     bool nonstop;
110 };
111 //-----------------------------------------------------------------------------
112 STG_STOPPER nonstop;
113 //-----------------------------------------------------------------------------
114 static void StartTimer()
115 {
116 STG_LOGGER & WriteServLog = GetStgLogger();
117
118 if (RunStgTimer())
119     {
120     WriteServLog("Cannot start timer. Fatal.");
121     //printfd(__FILE__, "Cannot start timer. Fatal.\n");
122     exit(1);
123     }
124 else
125     {
126     WriteServLog("Timer thread started successfully.");
127     //printfd(__FILE__, "Timer thread started successfully.\n");
128     }
129 }
130 //-----------------------------------------------------------------------------
131 void CatchPROF(int)
132 {
133 /*STG_LOGGER & WriteServLog = GetStgLogger();
134 WriteServLog("CatchPROF");*/
135 }
136 //-----------------------------------------------------------------------------
137 void CatchUSR1(int)
138 {
139
140 }
141 //-----------------------------------------------------------------------------
142 void CatchTERM(int sig)
143 {
144 /*
145  *Function Name:CatchINT
146  *Parameters: sig_num - ÎÏÍÅÒ ÓÉÇÎÁÌÁ
147  *Description: ïÂÒÁÂÏÔÞÉË ÓÉÇÎÁÌÁ INT
148  *Returns: îÉÞÅÇÏ
149  */
150 STG_LOGGER & WriteServLog = GetStgLogger();
151 WriteServLog("Shutting down... %d", sig);
152
153 //nonstop = false;
154 nonstop.Stop(__FILE__, __LINE__);
155
156 struct sigaction newsa, oldsa;
157 sigset_t sigmask;
158
159 sigemptyset(&sigmask);
160 sigaddset(&sigmask, SIGTERM);
161 newsa.sa_handler = SIG_IGN;
162 newsa.sa_mask = sigmask;
163 newsa.sa_flags = 0;
164 sigaction(SIGTERM, &newsa, &oldsa);
165
166 sigemptyset(&sigmask);
167 sigaddset(&sigmask, SIGINT);
168 newsa.sa_handler = SIG_IGN;
169 newsa.sa_mask = sigmask;
170 newsa.sa_flags = 0;
171 sigaction(SIGINT, &newsa, &oldsa);
172 }
173 //-----------------------------------------------------------------------------
174 void CatchPIPE(int)
175 {
176 STG_LOGGER & WriteServLog = GetStgLogger();
177 WriteServLog("Broken pipe!");
178 }
179 //-----------------------------------------------------------------------------
180 void CatchHUP(int)
181 {
182 needRulesReloading = true;
183 }
184 //-----------------------------------------------------------------------------
185 void CatchCHLD(int)
186 {
187 int status;
188 pid_t childPid;
189 childPid = waitpid(-1, &status, WNOHANG);
190
191 set<pid_t>::iterator pid;
192 pid = executersPid.find(childPid);
193 if (pid != executersPid.end())
194     {
195     executersPid.erase(pid);
196     if (executersPid.empty() && nonstop.GetStatus())
197         {
198         nonstop.Stop(__FILE__, __LINE__);
199         }
200     }
201 if (childPid == stgChildPid)
202     {
203     childExited = true;
204     }
205 }
206 //-----------------------------------------------------------------------------
207 void CatchSEGV(int, siginfo_t *, void *)
208 {
209 /*char fileName[50];
210 sprintf(fileName, "/tmp/stg_segv.%d", getpid());
211 FILE * f = fopen(fileName, "wt");
212 if (f)
213     {
214     fprintf(f, "\nSignal info:\n~~~~~~~~~~~~\n");
215     fprintf(f, "numb:\t %d (%d)\n", sinfo->si_signo, sig);
216     fprintf(f, "errn:\t %d\n", sinfo->si_errno);
217     fprintf(f, "code:\t %d ", sinfo->si_code);
218
219     switch (sinfo->si_code)
220         {
221         case SEGV_MAPERR:
222             fprintf(f, "(SEGV_MAPERR - address not mapped to object)\n");
223             break;
224
225         case SEGV_ACCERR:
226             fprintf(f, "(SEGV_ACCERR - invalid permissions for mapped object)\n");
227             break;
228
229         default:
230             fprintf(f, "???\n");
231         }
232
233     fprintf(f, "addr:\t 0x%.8X\n",
234         (unsigned int)sinfo->si_addr);
235
236     Dl_info dlinfo;
237     //asm("movl %eip, eip");
238     if (dladdr((void*)CatchCHLD, &dlinfo))
239         {
240         fprintf(f, "SEGV point: %s %s\n", dlinfo.dli_fname, dlinfo.dli_sname);
241         }
242     else
243         {
244         fprintf(f, "Cannot find SEGV point\n");
245         }
246
247     fclose(f);
248     }
249
250 struct sigaction segv_action, segv_action_old;
251
252 segv_action.sa_handler = SIG_DFL;
253 segv_action.sa_sigaction = NULL;
254 segv_action.sa_flags = SA_SIGINFO;
255 segv_action.sa_restorer = NULL;
256
257 sigaction(SIGSEGV, &segv_action, &segv_action_old);*/
258 }
259 //-----------------------------------------------------------------------------
260 static void SetSignalHandlers()
261 {
262 struct sigaction newsa, oldsa;
263 sigset_t sigmask;
264 ///////
265 sigemptyset(&sigmask);
266 sigaddset(&sigmask, SIGTERM);
267 newsa.sa_handler = CatchTERM;
268 newsa.sa_mask = sigmask;
269 newsa.sa_flags = 0;
270 sigaction(SIGTERM, &newsa, &oldsa);
271 ///////
272 sigemptyset(&sigmask);
273 sigaddset(&sigmask, SIGUSR1);
274 newsa.sa_handler = CatchUSR1;
275 newsa.sa_mask = sigmask;
276 newsa.sa_flags = 0;
277 sigaction(SIGUSR1, &newsa, &oldsa);
278 ///////
279 sigemptyset(&sigmask);
280 sigaddset(&sigmask, SIGINT);
281 newsa.sa_handler = CatchTERM;
282 newsa.sa_mask = sigmask;
283 newsa.sa_flags = 0;
284 sigaction(SIGINT, &newsa, &oldsa);
285 /*///////
286 sigemptyset(&sigmask);
287 sigaddset(&sigmask, SIGPROF);
288 newsa.sa_handler = CatchPROF;
289 newsa.sa_mask = sigmask;
290 newsa.sa_flags = 0;
291 sigaction(SIGPROF, &newsa, &oldsa);*/
292 //////
293 sigemptyset(&sigmask);
294 sigaddset(&sigmask, SIGPIPE);
295 newsa.sa_handler = CatchPIPE;
296 newsa.sa_mask = sigmask;
297 newsa.sa_flags = 0;
298 sigaction(SIGPIPE, &newsa, &oldsa);
299 //////
300 sigemptyset(&sigmask);
301 sigaddset(&sigmask, SIGHUP);
302 newsa.sa_handler = CatchHUP;
303 newsa.sa_mask = sigmask;
304 newsa.sa_flags = 0;
305 sigaction(SIGHUP, &newsa, &oldsa);
306 //////
307 sigemptyset(&sigmask);
308 sigaddset(&sigmask, SIGCHLD);
309 newsa.sa_handler = CatchCHLD;
310 newsa.sa_mask = sigmask;
311 newsa.sa_flags = 0;
312 sigaction(SIGCHLD, &newsa, &oldsa);
313
314 /*newsa.sa_handler = NULL;
315 newsa.sa_sigaction = CatchSEGV;
316 newsa.sa_flags = SA_SIGINFO;
317 newsa.sa_restorer = NULL;
318 sigaction(SIGSEGV, &newsa, &oldsa);*/
319
320 return;
321 }
322 //-----------------------------------------------------------------------------
323 int StartScriptExecuter(char * procName, int msgKey, int * msgID, SETTINGS * settings)
324 {
325 STG_LOGGER & WriteServLog = GetStgLogger();
326
327 if (*msgID == -11)   // If msgID == -11 - first call. Create queue
328     {
329     for (int i = 0; i < 2; i++)
330         {
331         //WriteServLog("Creating queue with key=%d ...", msgKey);
332         *msgID = msgget(msgKey, IPC_CREAT | IPC_EXCL | 0600);
333
334         if (*msgID == -1)
335             {
336             *msgID = msgget(msgKey, 0);
337             if (*msgID == -1)
338                 {
339                 WriteServLog("Message queue not created.");
340                 return -1;
341                 }
342             else
343                 {
344                 msgctl(*msgID, IPC_RMID, NULL);
345                 //printfd(__FILE__, "Queue removed!");
346                 }
347             }
348         else
349             {
350             WriteServLog("Message queue created successfully. msgKey=%d msgID=%d", msgKey, *msgID);
351             break;
352             }
353         }
354     }
355
356 pid_t executerPid = fork();
357
358 switch (executerPid)
359     {
360     case -1:    // ìÁÖÁ
361         WriteServLog("Fork error!");
362         return -1;
363
364     case 0:     // ðÏÔÏÍÏË
365         //close(0);
366         //close(1);
367         //close(2);
368         //setsid();
369         delete settings;
370         Executer(msgKey, *msgID, executerPid, procName);
371         return 1;
372
373     default:    // ïÓÎÏ×ÎÏÊ ÐÒÏÃÅÓÓ
374         if (executersPid.empty()) {
375             Executer(msgKey, *msgID, executerPid, NULL);
376         }
377         executersPid.insert(executerPid);
378     }
379 return 0;
380 }
381 //-----------------------------------------------------------------------------
382 #ifndef NO_DAEMON
383 int ForkAndWait(const string & confDir)
384 #else
385 int ForkAndWait(const string &)
386 #endif
387 {
388 #ifndef NO_DAEMON
389 stgChildPid = fork();
390 string startFile = confDir + START_FILE;
391 unlink(startFile.c_str());
392
393 switch (stgChildPid)
394     {
395     case -1:    // ìÁÖÁ
396         return -1;
397         break;
398
399     case 0:     // ðÏÔÏÍÏË
400         //close(0);
401         close(1);
402         close(2);
403         setsid();
404         break;
405
406     default:    // ïÓÎÏ×ÎÏÊ ÐÒÏÃÅÓÓ
407         for (int i = 0; i < 120 * 5; i++)
408             {
409             if (access(startFile.c_str(), F_OK) == 0)
410                 {
411                 //printf("Fork successfull. Exit.\n");
412                 unlink(startFile.c_str());
413                 exit(0);
414                 }
415
416             if (childExited)
417                 {
418                 unlink(startFile.c_str());
419                 exit(1);
420                 }
421             usleep(200000);
422             }
423         unlink(startFile.c_str());
424         exit(1);
425         break;
426     }
427 #endif
428 return 0;
429 }
430 //-----------------------------------------------------------------------------
431 void KillExecuters()
432 {
433 set<pid_t>::iterator pid;
434 pid = executersPid.begin();
435 while (pid != executersPid.end())
436     {
437     printfd(__FILE__, "KillExecuters pid=%d\n", *pid);
438     kill(*pid, SIGUSR1);
439     ++pid;
440     }
441 }
442 //-----------------------------------------------------------------------------
443 int main(int argc, char * argv[])
444 {
445
446 /*
447   Initialization order:
448   - Logger
449   - Stg timer
450   - Settings
451   - Plugins
452   - Plugins settings
453   - Read Admins
454   - Read Tariffs
455   - Read Users
456   - Start Users
457   - Start Traffcounter
458   - Start Plugins
459   - Start pinger
460   - Set signal nandlers
461   - Fork and exit
462  * */
463
464 SETTINGS * settings = NULL;
465 BASE_STORE * dataStore = NULL;
466 TARIFFS * tariffs = NULL;
467 ADMINS * admins = NULL;
468 USERS * users = NULL;
469 TRAFFCOUNTER * traffCnt = NULL;
470 int msgID = -11;
471
472     {
473     STG_LOGGER & WriteServLog = GetStgLogger();
474     WriteServLog.SetLogFileName("/var/log/stargazer.log");
475     }
476
477 vector<MODULE_SETTINGS> modSettings;
478 list<PLUGIN_RUNNER> modules;
479
480 list<PLUGIN_RUNNER>::iterator modIter;
481
482 if (getuid())
483     {
484     printf("You must be root. Exit.\n");
485     exit(1);
486     }
487
488 if (argc == 2)
489     settings = new SETTINGS(argv[1]);
490 else
491     settings = new SETTINGS();
492
493 if (settings->ReadSettings())
494     {
495     //printfd(__FILE__, "ReadSettings error.\n");
496     STG_LOGGER & WriteServLog = GetStgLogger();
497
498     if (settings->GetLogFileName() != "")
499         WriteServLog.SetLogFileName(settings->GetLogFileName());
500
501     WriteServLog("ReadSettings error. %s", settings->GetStrError().c_str());
502     exit(1);
503     }
504
505 #ifndef NO_DAEMON
506 string startFile(settings->GetConfDir() + START_FILE);
507 #endif
508
509 //SetSignalHandlers();
510 if (ForkAndWait(settings->GetConfDir()) < 0)
511     {
512     STG_LOGGER & WriteServLog = GetStgLogger();
513     WriteServLog("Fork error!");
514     exit(1);
515     }
516
517 STG_LOGGER & WriteServLog = GetStgLogger();
518 WriteServLog.SetLogFileName(settings->GetLogFileName());
519 WriteServLog("Stg v. %s", SERVER_VERSION);
520
521 for (int i = 0; i < settings->GetExecutersNum(); i++)
522     {
523     int ret = StartScriptExecuter(argv[0], settings->GetExecMsgKey(), &msgID, settings);
524     if (ret < 0)
525         {
526         STG_LOGGER & WriteServLog = GetStgLogger();
527         WriteServLog("Start Script Executer error!");
528         //goto exitLbl;
529         return 1;
530         }
531     if (ret == 1)
532         {
533         // Stopping child
534         return 0;
535         }
536     }
537
538 PIDFile pidFile(settings->GetPIDFileName());
539
540 StartTimer();
541 WaitTimer();
542 if (!IsStgTimerRunning())
543     {
544     printfd(__FILE__, "Timer thread not started in 1 sec!\n");
545     WriteServLog("Timer thread not started in 1 sec!");
546     }
547
548 EVENT_LOOP & loop(EVENT_LOOP_SINGLETON::GetInstance());
549
550 STORE_LOADER storeLoader(*settings);
551 if (storeLoader.Load())
552     {
553     WriteServLog("Storage plugin: '%s'", storeLoader.GetStrError().c_str());
554     goto exitLblNotStarted;
555     }
556
557 if (loop.Start())
558     {
559     WriteServLog("Event loop not started.");
560     goto exitLblNotStarted;
561     }
562
563 dataStore = storeLoader.GetStore();
564 WriteServLog("Storage plugin: %s. Loading successfull.", dataStore->GetVersion().c_str());
565
566 tariffs = new TARIFFS(dataStore);
567 admins = new ADMINS(dataStore);
568 users = new USERS(settings, dataStore, tariffs, admins->GetSysAdmin());
569 traffCnt = new TRAFFCOUNTER(users, tariffs, settings->GetRulesFileName());
570 traffCnt->SetMonitorDir(settings->GetMonitorDir());
571 //tariffs->SetUsers(users);
572
573 modSettings = settings->GetModulesSettings();
574
575 for (unsigned i = 0; i < modSettings.size(); i++)
576     {
577     string modulePath = settings->GetModulesPath();
578     modulePath += "/mod_";
579     modulePath += modSettings[i].moduleName;
580     modulePath += ".so";
581     printfd(__FILE__, "Module: %s\n", modulePath.c_str());
582     modules.push_back(
583         PLUGIN_RUNNER(modulePath,
584                       modSettings[i],
585                       admins,
586                       tariffs,
587                       users,
588                       traffCnt,
589                       dataStore,
590                       settings)
591         );
592     }
593
594 modIter = modules.begin();
595
596 while (modIter != modules.end())
597     {
598     //Loading modules
599     if (modIter->Load())
600         {
601         WriteServLog("Error: %s",
602                      modIter->GetStrError().c_str());
603         goto exitLblNotStarted;
604         }
605     ++modIter;
606     }
607
608 //Start section
609 if (users->Start())
610     {
611     goto exitLblNotStarted;
612     }
613 WriteServLog("Users started successfully.");
614
615 if (traffCnt->Start())
616     {
617     goto exitLblNotStarted;
618     }
619 WriteServLog("Traffcounter started successfully.");
620
621 //Sort by start order
622 modules.sort(StartModCmp);
623 modIter = modules.begin();
624
625 while (modIter != modules.end())
626     {
627     if (modIter->Start())
628         {
629         WriteServLog("Error: %s",
630                      modIter->GetStrError().c_str());
631         //printfd(__FILE__, "Error: %s\n", capRunner.GetStrError().c_str());
632         goto exitLbl;
633         }
634     WriteServLog("Module: \'%s\'. Start successfull. %d", modIter->GetPlugin()->GetVersion().c_str(),
635         modIter->GetPlugin()->GetStartPosition());
636     ++modIter;
637     }
638 SetSignalHandlers();
639
640 srandom(stgTime);
641
642 /*
643  * Note that an implementation in which nice returns the new nice value
644  * can legitimately return -1.   To  reliably  detect  an  error,  set
645  * errno to 0 before the call, and check its value when nice returns -1.
646  *
647  *
648  * (c) man 2 nice
649  */
650 errno = 0;
651 if (nice(-19) && errno) {
652     printfd(__FILE__, "nice failed: '%s'\n", strerror(errno));
653     WriteServLog("nice failed: '%s'", strerror(errno));
654 }
655
656 WriteServLog("Stg started successfully.");
657 WriteServLog("+++++++++++++++++++++++++++++++++++++++++++++");
658
659 #ifndef NO_DAEMON
660 creat(startFile.c_str(), S_IRUSR);
661 #endif
662
663 //*a_kill_it = 0;
664
665 while (nonstop.GetStatus())
666     {
667     if (needRulesReloading)
668         {
669         needRulesReloading = false;
670         traffCnt->Reload();
671
672         modIter = modules.begin();
673         for (; modIter != modules.end(); ++modIter)
674             {
675             if (modIter->Reload())
676                 {
677                 WriteServLog("Error reloading %s ('%s')", modIter->GetPlugin()->GetVersion().c_str(),
678                                                           modIter->GetStrError().c_str());
679                 printfd(__FILE__, "Error reloading %s ('%s')\n", modIter->GetPlugin()->GetVersion().c_str(),
680                                                                  modIter->GetStrError().c_str());
681                 }
682             }
683         }
684     stgUsleep(100000);
685     }
686
687 exitLbl:
688
689 WriteServLog("+++++++++++++++++++++++++++++++++++++++++++++");
690
691 //Sort by start order
692 modules.sort(StopModCmp);
693 modIter = modules.begin();
694 while (modIter != modules.end())
695     {
696     std::string name = modIter->GetFileName();
697     printfd(__FILE__, "Stopping module '%s'\n", name.c_str());
698     if (modIter->Stop())
699         {
700         WriteServLog("Module \'%s\': Error: %s",
701                      modIter->GetPlugin()->GetVersion().c_str(),
702                      modIter->GetStrError().c_str());
703         printfd(__FILE__, "Failed to stop module '%s'\n", name.c_str());
704         //printfd(__FILE__, "Error: %s\n", capRunner.GetStrError().c_str());
705         //goto exitLbl;
706         }
707     WriteServLog("Module: \'%s\'. Stop successfull.", modIter->GetPlugin()->GetVersion().c_str());
708     ++modIter;
709     }
710
711 if (loop.Stop())
712     {
713     WriteServLog("Event loop not stopped.");
714     }
715
716 exitLblNotStarted:
717
718 /*modIter = modules.begin();
719 while (modIter != modules.end())
720     {
721     std::string name = modIter->GetFileName();
722     printfd(__FILE__, "Unloading module '%s'\n", name.c_str());
723     if (modIter->Unload())
724         {
725         WriteServLog("Module \'%s\': Error: %s",
726                      name.c_str(),
727                      modIter->GetStrError().c_str());
728         printfd(__FILE__, "Failed to unload module '%s'\n", name.c_str());
729         }
730     ++modIter;
731     }*/
732
733 if (traffCnt)
734     {
735     traffCnt->Stop();
736     WriteServLog("Traffcounter: Stop successfull.");
737     }
738
739 if (users)
740     {
741     users->Stop();
742     WriteServLog("Users: Stop successfull.");
743     }
744
745 sleep(1);
746 int res = msgctl(msgID, IPC_RMID, NULL);
747 if (res)
748     WriteServLog("Queue was not removed. id=%d", msgID);
749 else
750     WriteServLog("Queue removed successfully.");
751
752 /*struct sigaction newsa, oldsa;
753 sigset_t sigmask;
754 sigemptyset(&sigmask);
755 sigaddset(&sigmask, SIGCHLD);
756 newsa.sa_handler = SIG_IGN;
757 newsa.sa_mask = sigmask;
758 newsa.sa_flags = 0;
759 sigaction(SIGCHLD, &newsa, &oldsa);*/
760
761 KillExecuters();
762
763 StopStgTimer();
764 WriteServLog("StgTimer: Stop successfull.");
765
766 WriteServLog("Stg stopped successfully.");
767 sleep(1);
768 WriteServLog("---------------------------------------------");
769
770 delete traffCnt;
771 delete users;
772 delete admins;
773 delete tariffs;
774 delete settings;
775
776 return 0;
777 }
778 //-----------------------------------------------------------------------------
779
780