diff --git a/include/libev.h b/include/libev.h index 41672ee..a1442ae 100644 --- a/include/libev.h +++ b/include/libev.h @@ -16,6 +16,11 @@ */ #pragma once +/** + * Dependencies + */ +#include + /** * Set up namespace */ diff --git a/src/tcpresolver.h b/src/tcpresolver.h index e16d626..162dfd8 100644 --- a/src/tcpresolver.h +++ b/src/tcpresolver.h @@ -112,9 +112,9 @@ private: // connection succeeded, mark socket as non-blocking if (_socket >= 0) { - // turn socket into a non-blocking socket - fcntl(_socket, F_SETFL, O_NONBLOCK); - + // turn socket into a non-blocking socket and set the close-on-exec bit + fcntl(_socket, F_SETFL, O_NONBLOCK | O_CLOEXEC); + // we want to enable "nodelay" on sockets (otherwise all send operations are s-l-o-w int optval = 1;