[Bug 3999] Fix for net_qport always set to 0.

bugzilla-daemon at icculus.org bugzilla-daemon at icculus.org
Mon Mar 2 00:04:45 EST 2009


http://bugzilla.icculus.org/show_bug.cgi?id=3999





------- Comment #1 from monson.kyle at gmail.com  2009-03-02 00:04 EDT -------
Created an attachment (id=2001)
 --> (http://bugzilla.icculus.org/attachment.cgi?id=2001&action=view)
Patch to fix net_qport bug.

OK, better description this time:

net_qport is the mechanism that quake 3 uses to distinguish between clients
running on the same machine or behind a buggy nat. net_qport is supposed to be
randomly generated on start up. Currently net_qport is always zero. 

Repro:

Start the game and pull down console.
/net_qport.

Actual:
"net_qport is "0" the default

Expected:
"net_qport is <some random number between 0 and 64k> the default"

The net result is that more than one client behind a buggy nat cannot connect
to the same server.

The problem is that a call to Sys_Milliseconds in main was lost when the unix
and win32 main functions were merged some time ago. This makes the call to
Com_Milliseconds when generating net_qport the first call to Sys_Milliseconds
resulting in a zero value every time. 

There is also a new problem with using Com_Milliseconds as systems get faster.
The range of values generated using this method gets smaller and smaller. Using
a debug build I saw values just over 1000 constantly. I elected to use
Com_RandomBytes to generate a random int to use for Netchan_Init as this better
makes use of the entire range of possible values.

Restoring the call to Sys_Milliseconds in main is still required. com_frameTime
depends on Com_Milliseconds returning a non-zero value when it it called.
Without the Sys_Milliseconds call in main we shift the problem to a different
system. 


-- 
Configure bugmail: http://bugzilla.icculus.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug, or are watching the QA contact.



More information about the quake3-bugzilla mailing list