summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrond Norbye <trond.norbye@gmail.com>2011-04-12 11:44:39 +0200
committerTrond Norbye <trond.norbye@gmail.com>2011-04-12 11:44:39 +0200
commitcc3941084188195fc8b43fcdc05cec3dab5a4bd4 (patch)
treea5bcf36d7b1dfdce06956a9ff36d83dba8dc228a
parent6debef043b7da953c6a427ed687cd0b1d1185dec (diff)
downloadmemcached-cc3941084188195fc8b43fcdc05cec3dab5a4bd4.tar.gz
msghdr->msg_namelen should only be set for UDP
We are currently using sockaddr_storage to keep track of the address (to support IPV6), but this caused sendmsg to fail on OpenBSD with EINVAL. The socket is already in a connected state, so we don't need to pass in the socket address. Our test coverage is a bit low for UDP, so I leave the initalization there for now. I'm pretty sure that we could just set this to zero here, because we reset the member each time we receive a packet in try_read_udp().
-rw-r--r--daemon/memcached.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/daemon/memcached.c b/daemon/memcached.c
index 99ece9a..299f502 100644
--- a/daemon/memcached.c
+++ b/daemon/memcached.c
@@ -574,10 +574,7 @@ conn *conn_new(const SOCKET sfd, STATE_FUNC init_state,
c->transport = transport;
c->protocol = settings.binding_protocol;
- /* unix socket mode doesn't need this, so zeroed out. but why
- * is this done for every command? presumably for UDP
- * mode. */
- if (!settings.socketpath) {
+ if (IS_UDP(transport)) {
c->request_addr_size = sizeof(c->request_addr);
} else {
c->request_addr_size = 0;