63 timeout.tv_sec = 0; |
63 timeout.tv_sec = 0; |
64 timeout.tv_usec = 250000; // 0.25 seconds |
64 timeout.tv_usec = 250000; // 0.25 seconds |
65 FD_ZERO (&fdset); |
65 FD_ZERO (&fdset); |
66 FD_SET (0, &fdset); |
66 FD_SET (0, &fdset); |
67 |
67 |
68 { |
68 int fd = iface.get_session()->socket()->file_descriptor(); |
69 int fd = RCONSession::get_session()->socket()->file_descriptor(); |
69 highest = max (highest, fd); |
70 highest = max (highest, fd); |
70 FD_SET (fd, &fdset); |
71 FD_SET (fd, &fdset); |
|
72 } |
|
73 |
71 |
74 select (highest + 1, &fdset, nullptr, nullptr, &timeout); |
72 select (highest + 1, &fdset, nullptr, nullptr, &timeout); |
75 |
73 |
76 if (FD_ISSET (0, &fdset)) |
74 if (FD_ISSET (0, &fdset)) |
|
75 { |
77 // stdin is ready, what's incoming? |
76 // stdin is ready, what's incoming? |
78 Interface::handle_input(); |
77 iface.handle_input(); |
|
78 } |
79 |
79 |
80 RCONSession::get_session()->tick(); |
80 iface.get_session()->tick(); |
81 Interface::render(); |
81 iface.render(); |
82 } |
82 } |
83 } |
83 } |
84 catch (const Exitception&) {} |
84 catch (const Exitception&) {} |
85 |
85 |
86 RCONSession::get_session()->disconnect(); |
86 iface.get_session()->disconnect(); |
87 return EXIT_SUCCESS; |
87 return EXIT_SUCCESS; |
88 } |
88 } |