Explorar el Código

[udp] Avoid reusing auto-allocated ports after connection close.

This duplicates a fix made to tcp.c in commit
d5735c631c.
tags/v0.9.4
Michael Brown hace 16 años
padre
commit
21e9e801e2
Se han modificado 1 ficheros con 3 adiciones y 2 borrados
  1. 3
    2
      src/net/udp.c

+ 3
- 2
src/net/udp.c Ver fichero

@@ -55,11 +55,12 @@ struct tcpip_protocol udp_protocol;
55 55
  */
56 56
 static int udp_bind ( struct udp_connection *udp ) {
57 57
 	struct udp_connection *existing;
58
-	static uint16_t try_port = 1024;
58
+	static uint16_t try_port = 1023;
59 59
 
60 60
 	/* If no port specified, find the first available port */
61 61
 	if ( ! udp->local.st_port ) {
62
-		for ( ; try_port ; try_port++ ) {
62
+		while ( try_port ) {
63
+			try_port++;
63 64
 			if ( try_port < 1024 )
64 65
 				continue;
65 66
 			udp->local.st_port = htons ( try_port );

Loading…
Cancelar
Guardar