X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=libmemcached%2Fio.cc;h=019eafb6e5c9104771f95885d89786d65fda1e2c;hb=8cf5f36e16ecaf6e1e7622a3a7cad81491602b0d;hp=837959da5db6696765036ffe5787741c8235658c;hpb=674c7578fa870c3b57e81e765c355ce98434b310;p=awesomized%2Flibmemcached diff --git a/libmemcached/io.cc b/libmemcached/io.cc index 837959da..019eafb6 100644 --- a/libmemcached/io.cc +++ b/libmemcached/io.cc @@ -39,6 +39,10 @@ #include +#ifdef HAVE_SYS_SOCKET_H +# include +#endif + void initialize_binary_request(org::libmemcached::Instance* server, protocol_binary_request_header& header) { server->request_id++; @@ -330,7 +334,16 @@ static bool io_flush(org::libmemcached::Instance* ptr, WATCHPOINT_ASSERT(ptr->fd != INVALID_SOCKET); WATCHPOINT_ASSERT(write_length > 0); - int flags= with_flush ? MSG_NOSIGNAL|MSG_DONTWAIT : MSG_NOSIGNAL|MSG_DONTWAIT|MSG_MORE; + int flags; + if (with_flush) + { + flags= MSG_NOSIGNAL|MSG_DONTWAIT; + } + else + { + flags= MSG_NOSIGNAL|MSG_DONTWAIT|MSG_MORE; + } + ssize_t sent_length= ::send(ptr->fd, local_write_ptr, write_length, flags); if (sent_length == SOCKET_ERROR) @@ -699,7 +712,7 @@ void memcached_io_close(org::libmemcached::Instance* ptr) } /* in case of death shutdown to avoid blocking at close() */ - if (shutdown(ptr->fd, SHUT_RDWR) == SOCKET_ERROR && get_socket_errno() != ENOTCONN) + if (shutdown(ptr->fd, SHUT_RDWR) == SOCKET_ERROR and get_socket_errno() != ENOTCONN) { WATCHPOINT_NUMBER(ptr->fd); WATCHPOINT_ERRNO(get_socket_errno());