socket connections have close-on-exit bit set

This commit is contained in:
Emiel Bruijntjes 2015-12-14 20:20:03 +01:00
parent e2ce7103aa
commit 226ef47beb
1 changed files with 3 additions and 0 deletions

View File

@ -114,6 +114,9 @@ private:
{ {
// turn socket into a non-blocking socket // turn socket into a non-blocking socket
fcntl(_socket, F_SETFL, O_NONBLOCK); fcntl(_socket, F_SETFL, O_NONBLOCK);
// switch on the close-on-exec bit
fcntl(_socket, F_SETFL, O_CLOEXEC);
// we want to enable "nodelay" on sockets (otherwise all send operations are s-l-o-w // we want to enable "nodelay" on sockets (otherwise all send operations are s-l-o-w
int optval = 1; int optval = 1;