diff --git a/src/fne/network/influxdb/InfluxDB.h b/src/fne/network/influxdb/InfluxDB.h index 91155ffa..520ba2e4 100644 --- a/src/fne/network/influxdb/InfluxDB.h +++ b/src/fne/network/influxdb/InfluxDB.h @@ -189,6 +189,7 @@ namespace network return 1; } + // set SO_REUSEADDR option const int sockOptVal = 1; if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &sockOptVal, sizeof(int)) < 0) { LogError(LOG_NET, "Failed to connect to InfluxDB server, err: %d", errno); @@ -196,6 +197,13 @@ namespace network return 1; } + // set SO_LINGER option + linger lin; + lin.l_onoff = 0; + lin.l_linger = 2; + + setsockopt(fd, SOL_SOCKET, SO_LINGER, (const char *)&lin, sizeof(int)); + // connect to the server ret = connect(fd, addr->ai_addr, addr->ai_addrlen); if (ret < 0) {