Skip to content

Commit bb6e85d

Browse files
committed
Add timewait timeout for Closing -> Time_wait transition
1 parent 1ba2e7e commit bb6e85d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/tcp/state.ml

+7-1
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,13 @@ module Make(Time:Mirage_time.S) = struct
151151
| Fin_wait_2 _, Recv_fin ->
152152
Lwt.async (fun () -> timewait t time_wait_time);
153153
Time_wait
154-
| Closing a, Recv_ack b -> if diffone b a then Time_wait else Closing a
154+
| Closing a, Recv_ack b ->
155+
if diffone b a then
156+
begin
157+
Lwt.async (fun () -> timewait t time_wait_time);
158+
Time_wait
159+
end
160+
else Closing a
155161
| Closing _, Timeout -> t.on_close (); Closed
156162
| Closing _, Recv_rst -> t.on_close (); Reset
157163
| Time_wait, Timeout -> t.on_close (); Closed

0 commit comments

Comments
 (0)