mirror of
https://github.com/xcat2/xNBA.git
synced 2024-11-29 12:49:49 +00:00
[udp] Avoid reusing auto-allocated ports after connection close.
This duplicates a fix made to tcp.c in commit
d5735c631c
.
This commit is contained in:
parent
6f39dfe6c0
commit
21e9e801e2
@ -55,11 +55,12 @@ struct tcpip_protocol udp_protocol;
|
||||
*/
|
||||
static int udp_bind ( struct udp_connection *udp ) {
|
||||
struct udp_connection *existing;
|
||||
static uint16_t try_port = 1024;
|
||||
static uint16_t try_port = 1023;
|
||||
|
||||
/* If no port specified, find the first available port */
|
||||
if ( ! udp->local.st_port ) {
|
||||
for ( ; try_port ; try_port++ ) {
|
||||
while ( try_port ) {
|
||||
try_port++;
|
||||
if ( try_port < 1024 )
|
||||
continue;
|
||||
udp->local.st_port = htons ( try_port );
|
||||
|
Loading…
Reference in New Issue
Block a user