26 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
26 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
27 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
27 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
28 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
28 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ |
29 */ |
30 |
30 |
31 #include "main.h" |
|
32 |
|
33 #ifndef _WIN32 |
31 #ifndef _WIN32 |
34 # include <sys/select.h> |
32 # include <sys/select.h> |
35 #else |
33 #else |
36 # include <winsock2.h> |
34 # include <winsock2.h> |
37 #endif |
35 #endif |
38 |
36 |
39 #include <time.h> |
37 #include "main.h" |
40 #include "network/rconsession.h" |
38 #include "network/rconsession.h" |
41 #include "huffman.h" |
39 #include "huffman.h" |
42 #include "interface.h" |
40 #include "interface.h" |
43 |
41 |
44 // ------------------------------------------------------------------------------------------------- |
42 // ------------------------------------------------------------------------------------------------- |
85 timeout.tv_usec = 250000; // 0.25 seconds |
83 timeout.tv_usec = 250000; // 0.25 seconds |
86 FD_ZERO (&fdset); |
84 FD_ZERO (&fdset); |
87 FD_SET (0, &fdset); |
85 FD_SET (0, &fdset); |
88 |
86 |
89 int fd = iface.get_session()->socket()->file_descriptor(); |
87 int fd = iface.get_session()->socket()->file_descriptor(); |
90 highest = max (highest, fd); |
88 highest = zfc::max (highest, fd); |
91 FD_SET (fd, &fdset); |
89 FD_SET (fd, &fdset); |
92 |
90 |
93 select (highest + 1, &fdset, nullptr, nullptr, &timeout); |
91 select (highest + 1, &fdset, nullptr, nullptr, &timeout); |
94 |
92 |
95 if (FD_ISSET (0, &fdset)) |
93 if (FD_ISSET (0, &fdset)) |