X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=test%2Flib%2FConnection.cpp;h=82414f135127d373588e37b67846365e3b599a2b;hb=4ef24d8849ffcce9fdc78ef9907aa744a69687dc;hp=05440723455bfc787caba43a18cb78c800560447;hpb=9f262c9ea92d4869715ca6f534c80075a8310ac1;p=awesomized%2Flibmemcached diff --git a/test/lib/Connection.cpp b/test/lib/Connection.cpp index 05440723..82414f13 100644 --- a/test/lib/Connection.cpp +++ b/test/lib/Connection.cpp @@ -1,16 +1,21 @@ #include "Connection.hpp" +#include "p9y/poll.hpp" #include -#include -#include -#include +#if HAVE_UNISTD_H +# include +#endif + +#if !(HAVE_SOCK_NONBLOCK && HAVE_SOCK_CLOEXEC) +# include +# define SOCK_NONBLOCK O_NONBLOCK +# define SOCK_CLOEXEC O_CLOEXEC +#endif static inline int socket_ex(int af, int so, int pf, int fl) { #if HAVE_SOCK_NONBLOCK && HAVE_SOCK_CLOEXEC return socket(af, so | fl, pf); #else -# define SOCK_NONBLOCK O_NONBLOCK -# define SOCK_CLOEXEC O_CLOEXEC auto sock = socket(af, so, pf); if (0 <= sock) { if (0 > fcntl(sock, F_SETFL, fl | fcntl(sock, F_GETFL))) { @@ -186,10 +191,9 @@ bool Connection::open() { string Connection::error(const initializer_list &args) { stringstream ss; - for (auto &arg : args) { + for (const auto &arg : args) { ss << arg; } - cerr << ss.str() << endl; return ss.str(); }