Browse Source

Temporarily work around the bug when port numbers are reused between

subsequent runs.
tags/v0.9.3
Michael Brown 18 years ago
parent
commit
dc8b96b446
1 changed files with 7 additions and 0 deletions
  1. 7
    0
      src/net/tcp.c

+ 7
- 0
src/net/tcp.c View File

@@ -562,6 +562,13 @@ int tcp_listen ( struct tcp_connection *conn, uint16_t local_port ) {
562 562
 	static uint16_t try_port = 1024;
563 563
 	int rc;
564 564
 
565
+#warning "Fix the port re-use bug"
566
+	/* If we re-use the same port, the connection should be reset
567
+	 * and a new connection set up.  This doesn't happen yet, so
568
+	 * randomise the port to avoid hitting the problem.
569
+	 */
570
+	try_port = random();
571
+
565 572
 	/* If no port specified, find the first available port */
566 573
 	if ( ! local_port ) {
567 574
 		for ( ; try_port ; try_port++ ) {

Loading…
Cancel
Save