-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathtime-wait.patch
41 lines (41 loc) · 1.28 KB
/
time-wait.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
diff --git a/src/core/tcp.c b/src/core/tcp.c
index c98c43f..b019c3a 100644
--- a/src/core/tcp.c
+++ b/src/core/tcp.c
@@ -1778,7 +1778,7 @@ tcp_kill_state(enum tcp_state state)
* Kills the oldest connection that is in TIME_WAIT state.
* Called from tcp_alloc() if no more connections are available.
*/
-static void
+void
tcp_kill_timewait(void)
{
struct tcp_pcb *pcb, *inactive;
diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c
index 428a6f4..efd4a51 100644
--- a/src/core/tcp_in.c
+++ b/src/core/tcp_in.c
@@ -997,6 +997,7 @@ tcp_process(struct tcp_pcb *pcb)
TCP_RMV_ACTIVE(pcb);
pcb->state = TIME_WAIT;
TCP_REG(&tcp_tw_pcbs, pcb);
+ TCP_TW_LIMIT(MEMP_NUM_TCP_PCB_TIME_WAIT);
} else {
tcp_ack_now(pcb);
pcb->state = CLOSING;
@@ -1015,6 +1016,7 @@ tcp_process(struct tcp_pcb *pcb)
TCP_RMV_ACTIVE(pcb);
pcb->state = TIME_WAIT;
TCP_REG(&tcp_tw_pcbs, pcb);
+ TCP_TW_LIMIT(MEMP_NUM_TCP_PCB_TIME_WAIT);
}
break;
case CLOSING:
@@ -1025,6 +1027,7 @@ tcp_process(struct tcp_pcb *pcb)
TCP_RMV_ACTIVE(pcb);
pcb->state = TIME_WAIT;
TCP_REG(&tcp_tw_pcbs, pcb);
+ TCP_TW_LIMIT(MEMP_NUM_TCP_PCB_TIME_WAIT);
}
break;
case LAST_ACK: