Moved thread start to the wrapped close() function. This allows the thread to start with processes that do not use networking.
@@ -294,10 +294,6 @@ void doNetMetric(enum metric_t type, int fd, enum control_type_t source)
char proto[PROTOCOL_STR];
in_port_t localPort, remotePort;
- if (g_threadOnce == FALSE) {
- doThread();
- }
-
if (g_netinfo == NULL) {
return;
}
@@ -927,6 +923,10 @@ int close(int fd)
return -1;
}
+ if (g_threadOnce == FALSE) {
+ doThread();
+ }
+
rc = g_fn.close(fd);
if (rc != -1) {
doClose(fd, "close\n");
