Fix: leak fd
This commit is contained in:
parent
041d55e584
commit
d3708c5e66
|
@ -960,13 +960,14 @@ private int getBacklogSize()
|
||||||
int backlog = 128;
|
int backlog = 128;
|
||||||
version(linux)
|
version(linux)
|
||||||
{
|
{
|
||||||
import core.stdc.stdio : fopen, fscanf;
|
import core.stdc.stdio : fclose, fopen, fscanf;
|
||||||
auto somaxconn = fopen("/proc/sys/net/core/somaxconn", "re");
|
auto somaxconn = fopen("/proc/sys/net/core/somaxconn", "re");
|
||||||
if(somaxconn)
|
if(somaxconn)
|
||||||
{
|
{
|
||||||
int tmp;
|
int tmp;
|
||||||
if (fscanf(somaxconn, "%d", &tmp) == 1)
|
if (fscanf(somaxconn, "%d", &tmp) == 1)
|
||||||
backlog = tmp;
|
backlog = tmp;
|
||||||
|
fclose(somaxconn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return backlog;
|
return backlog;
|
||||||
|
|
Loading…
Reference in a new issue