projects
/
awesomized
/
libmemcached
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
ci: gh-actions: package: exclude only conflicting ubuntu18-gnu-new
[awesomized/libmemcached]
/
src
/
bin
/
memcapable.cc
diff --git
a/src/bin/memcapable.cc
b/src/bin/memcapable.cc
index 1b9af02a5dc4bd596408351b8df6845255e55199..a95fc1d10ee5827d3ca294fce0b1f0ed8d2cd240 100644
(file)
--- a/
src/bin/memcapable.cc
+++ b/
src/bin/memcapable.cc
@@
-32,14
+32,12
@@
# include <unistd.h>
#endif
# include <unistd.h>
#endif
-#i
fndef HAVE_GETOPT_H
-#
include "../../win32/getopt.h
"
-#
endif
+#i
nclude "p9y/getopt.hpp"
+#
include "p9y/socket.hpp
"
+#
include "p9y/poll.hpp"
-#include "libmemcached-1.0/memcached.h"
-#include "libmemcached/poll.h"
-#include "libmemcached/socket.hpp"
-#include "libmemcachedprotocol-0.0/binary.h"
+#include "libmemcached-1/memcached.h"
+#include "libmemcachedprotocol-0/binary.h"
#include "libmemcached/byteorder.h"
#include <vector>
#include "libmemcached/byteorder.h"
#include <vector>
@@
-132,14
+130,14
@@
static memcached_socket_t set_noblock(void) {
int flags = fcntl(sock, F_GETFL, 0);
if (flags == -1) {
perror("Failed to get socket flags");
int flags = fcntl(sock, F_GETFL, 0);
if (flags == -1) {
perror("Failed to get socket flags");
-
memcached_close_
socket(sock);
+
close
socket(sock);
return INVALID_SOCKET;
}
if ((flags & O_NONBLOCK) != O_NONBLOCK) {
if (fcntl(sock, F_SETFL, flags | O_NONBLOCK) == -1) {
perror("Failed to set socket to nonblocking mode");
return INVALID_SOCKET;
}
if ((flags & O_NONBLOCK) != O_NONBLOCK) {
if (fcntl(sock, F_SETFL, flags | O_NONBLOCK) == -1) {
perror("Failed to set socket to nonblocking mode");
-
memcached_close_
socket(sock);
+
close
socket(sock);
return INVALID_SOCKET;
}
}
return INVALID_SOCKET;
}
}
@@
-183,8
+181,8
@@
static ssize_t timeout_io_op(memcached_socket_t fd, short direction, const char
} else {
ret = recv(fd, const_cast<char *>(buf), len, 0);
}
} else {
ret = recv(fd, const_cast<char *>(buf), len, 0);
}
-
- if (ret == SOCKET_ERROR &&
get_socket_errno() == EWOULDBLOCK
) {
+ int local_errno = get_socket_errno();
+ if (ret == SOCKET_ERROR &&
local_errno == EWOULDBLOCK || (EAGAIN != EWOULDBLOCK && local_errno == EAGAIN)
) {
struct pollfd fds;
memset(&fds, 0, sizeof(struct pollfd));
fds.events = direction;
struct pollfd fds;
memset(&fds, 0, sizeof(struct pollfd));
fds.events = direction;