Skip to content

Commit

Permalink
Waiting the remaining tcp data are sent
Browse files Browse the repository at this point in the history
So that the tcp socket are closed by debugger client first and
the debugger client won't receive socket are closed by remote error

JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo [email protected]
  • Loading branch information
lygstate committed Jan 18, 2021
1 parent 90d206d commit ecbbe96
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions jerry-ext/debugger/debugger-tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,16 @@ jerryx_debugger_tcp_close (jerry_debugger_transport_header_t *header_p) /**< tcp

jerryx_debugger_transport_tcp_t *tcp_p = (jerryx_debugger_transport_tcp_t *) header_p;

/**
* Waiting the remaining tcp data are sent, so that the tcp socket are
* closed by debugger client first and the debugger client won't receive
* socket are closed by remote error
*/
for (int i = 0; i < 5; i += 1)
{
jerry_debugger_transport_sleep ();
}

JERRYX_DEBUG_MSG ("TCP connection closed.\n");

jerryx_debugger_tcp_close_socket (tcp_p->tcp_socket);
Expand Down

0 comments on commit ecbbe96

Please sign in to comment.