diff options
author | ludwig <ludwig@edf5b092-35ff-0310-97b2-ce42778d08ea> | 2009-03-02 18:08:13 +0000 |
---|---|---|
committer | ludwig <ludwig@edf5b092-35ff-0310-97b2-ce42778d08ea> | 2009-03-02 18:08:13 +0000 |
commit | 93afc16a582ed1f2cf5936c55e80d26a606bbdfb (patch) | |
tree | 2a9188081dc2fed0c7fd56a20ae78c22866ceb62 | |
parent | 865222ee61397e688bc3fba57898f285ee38d2c0 (diff) | |
download | ioquake3-aero-93afc16a582ed1f2cf5936c55e80d26a606bbdfb.tar.gz ioquake3-aero-93afc16a582ed1f2cf5936c55e80d26a606bbdfb.zip |
initialize qport with random value instead of time (#3999)
git-svn-id: svn://svn.icculus.org/quake3/trunk@1506 edf5b092-35ff-0310-97b2-ce42778d08ea
-rw-r--r-- | code/qcommon/common.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/code/qcommon/common.c b/code/qcommon/common.c index 4436aea..46ad77b 100644 --- a/code/qcommon/common.c +++ b/code/qcommon/common.c @@ -2509,6 +2509,7 @@ Com_Init */ void Com_Init( char *commandLine ) { char *s; + int qport; Com_Printf( "%s %s %s\n", Q3_VERSION, PLATFORM_STRING, __DATE__ ); @@ -2627,7 +2628,13 @@ void Com_Init( char *commandLine ) { com_version = Cvar_Get ("version", s, CVAR_ROM | CVAR_SERVERINFO ); Sys_Init(); - Netchan_Init( Com_Milliseconds() & 0xffff ); // pick a port value that should be nice and random + + // Pick a port value that should be nice and random. + // As machines get faster Com_Milliseconds can't be used + // anymore as it results in a smaller and smaller range of + // qport values. + Com_RandomBytes( (byte*)&qport, sizeof(int) ); + Netchan_Init( qport & 0xffff ); VM_Init(); SV_Init(); |