aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/runtime_tools/c_src/trace_ip_drv.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/runtime_tools/c_src/trace_ip_drv.c b/lib/runtime_tools/c_src/trace_ip_drv.c
index c73630f702..195558f958 100644
--- a/lib/runtime_tools/c_src/trace_ip_drv.c
+++ b/lib/runtime_tools/c_src/trace_ip_drv.c
@@ -374,6 +374,7 @@ static void trace_ip_output(ErlDrvData handle, char *buff, ErlDrvSizeT bufflen)
}
return;
}
+ ASSERT(!IS_INVALID_SOCKET(data->fd));
if (data->que[data->questart] != NULL) {
trace_ip_ready_output(handle, sock2event(data->fd));
}
@@ -412,6 +413,7 @@ static void trace_ip_ready_input(ErlDrvData handle, ErlDrvEvent fd)
/*
** Maybe accept, we are a listen port...
*/
+ ASSERT(IS_INVALID_SOCKET(data->fd));
if (!IS_INVALID_SOCKET((client = my_accept(data->listenfd)))) {
data->fd = client;
set_nonblocking(client);
@@ -735,6 +737,7 @@ static void close_client(TraceIpData *data)
{
my_driver_select(data, data->fd, FLAG_WRITE | FLAG_READ, SELECT_CLOSE);
data->flags |= FLAG_LISTEN_PORT;
+ data->fd = INVALID_SOCKET;
if (!(data->flags & FLAG_FILL_ALWAYS)) {
clean_que(data);
}