mirror of
https://github.com/ioquake/ioq3.git
synced 2024-11-10 15:21:35 +00:00
initialize qport with random value instead of time (#3999)
This commit is contained in:
parent
ae612721a3
commit
35a27638fe
1 changed files with 8 additions and 1 deletions
|
@ -2509,6 +2509,7 @@ Com_Init
|
||||||
*/
|
*/
|
||||||
void Com_Init( char *commandLine ) {
|
void Com_Init( char *commandLine ) {
|
||||||
char *s;
|
char *s;
|
||||||
|
int qport;
|
||||||
|
|
||||||
Com_Printf( "%s %s %s\n", Q3_VERSION, PLATFORM_STRING, __DATE__ );
|
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 );
|
com_version = Cvar_Get ("version", s, CVAR_ROM | CVAR_SERVERINFO );
|
||||||
|
|
||||||
Sys_Init();
|
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();
|
VM_Init();
|
||||||
SV_Init();
|
SV_Init();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue