Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2011-01-27 12:25:36 +0000
committerStijn Buys <ingar@osirion.org>2011-01-27 12:25:36 +0000
commit45b93da49b74acd7389e4faa1cfd5dba6cd75c95 (patch)
tree256f8c7037810598427116414f4e74cf7cbd0357 /src/core/netserver.cc
parentc3182222bd3fef6009f98205c0203d61a7509b11 (diff)
Added net_selecttimeout cvar and changed the default timeout to 10,000 microseconds.
Diffstat (limited to 'src/core/netserver.cc')
-rw-r--r--src/core/netserver.cc11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/core/netserver.cc b/src/core/netserver.cc
index 4769f68..937d91b 100644
--- a/src/core/netserver.cc
+++ b/src/core/netserver.cc
@@ -187,7 +187,16 @@ void NetServer::receive()
timeval timeout;
timeout.tv_sec = 0;
- timeout.tv_usec = 2500;
+
+ // 1,000,000 microseconds = 1 second, default is 2500
+ timeout.tv_usec = (long) Cvar::net_selecttimeout->value();
+ if (timeout.tv_usec < 0)
+ timeout.tv_usec = 0;
+ else if (timeout.tv_usec > 1000000) {
+ timeout.tv_sec = timeout.tv_usec / 1000000;
+ timeout.tv_usec %= 1000000;
+ }
+
fd_set readset = serverset;
int nb = select(fd() + 1, &readset, NULL, NULL, &timeout);