sources/main.cpp

changeset 51
481073b016a9
parent 31
b5b5a6a96d91
child 58
d175243ad169
equal deleted inserted replaced
50:874bbfa55da8 51:481073b016a9
33 #include "main.h" 33 #include "main.h"
34 #include "network/rconsession.h" 34 #include "network/rconsession.h"
35 #include "huffman/huffman.h" 35 #include "huffman/huffman.h"
36 #include "interface.h" 36 #include "interface.h"
37 37
38 static bool g_shouldExit = false;
39
40 // ------------------------------------------------------------------------------------------------- 38 // -------------------------------------------------------------------------------------------------
41 // 39 //
42 FUNCTION 40 FUNCTION
43 main (int argc, char* argv[]) -> int 41 main (int argc, char* argv[]) -> int
44 { 42 {
58 56
59 try 57 try
60 { 58 {
61 for (;;) 59 for (;;)
62 { 60 {
63 if (g_shouldExit)
64 break;
65
66 fd_set fdset; 61 fd_set fdset;
67 int highest = 0; 62 int highest = 0;
68 timeval timeout; 63 timeval timeout;
69 timeout.tv_sec = 0; 64 timeout.tv_sec = 0;
70 timeout.tv_usec = 250000; // 0.25 seconds 65 timeout.tv_usec = 250000; // 0.25 seconds
96 if (RCONSession::get_session()) 91 if (RCONSession::get_session())
97 RCONSession::get_session()->disconnect(); 92 RCONSession::get_session()->disconnect();
98 93
99 return EXIT_SUCCESS; 94 return EXIT_SUCCESS;
100 } 95 }
101
102 // -------------------------------------------------------------------------------------------------
103 //
104 FUNCTION
105 request_exit() -> void
106 {
107 g_shouldExit = true;
108 }

mercurial