disable linger for InfluxDB;

pull/72/head
Bryan Biedenkapp 1 year ago
parent b637a14f2d
commit a009d3345f

@ -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) {

Loading…
Cancel
Save

Powered by TurnKey Linux.