Skip to content

Commit 610e6d3

Browse files
committed
MB-30610: Don't fail server_socket() if at least one protocol successful
When attempting to listen to all protocols on a given network interface, return success from server_socket() as long as at least one of IPv4,IPv6 was successful. Note this restores to the pre-5.5 behaviour - http://review.couchbase.org/#/c/90791/ (added in 5.5) changed to fail if any protocol which was enabled failed. Change-Id: I6533b9d53459542778d75844d60883fa37f03aec Reviewed-on: http://review.couchbase.org/97325 Reviewed-by: Trond Norbye <[email protected]> Tested-by: Build Bot <[email protected]> Well-Formed: Build Bot <[email protected]>
1 parent 96853b1 commit 610e6d3

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

daemon/memcached.cc

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1184,8 +1184,8 @@ static void add_listening_port(const NetworkInterface *interf, in_port_t port, s
11841184
/**
11851185
* Create a socket and bind it to a specific port number
11861186
* @param interface the interface to bind to
1187-
* @param true if we was able to set up this interface
1188-
* false if we failed to set up this interface
1187+
* @param true if we was able to set up at least one address on the interface
1188+
* false if we failed to set any addresses on the interface
11891189
*/
11901190
static bool server_socket(const NetworkInterface& interf) {
11911191
SOCKET sfd;
@@ -1286,25 +1286,23 @@ static bool server_socket(const NetworkInterface& interf) {
12861286

12871287
freeaddrinfo(ai);
12881288

1289-
bool ret = true;
1290-
12911289
if (interf.ipv4 && !ipv4) {
12921290
// Failed to create an IPv4 port
12931291
LOG_CRITICAL(R"(Failed to create IPv4 port for "{}:{}")",
12941292
interf.host.empty() ? "*" : interf.host,
12951293
interf.port);
1296-
ret = false;
12971294
}
12981295

12991296
if (interf.ipv6 && !ipv6) {
13001297
// Failed to create an IPv6 oprt
13011298
LOG_CRITICAL(R"(Failed to create IPv6 port for "{}:{}")",
13021299
interf.host.empty() ? "*" : interf.host,
13031300
interf.port);
1304-
ret = false;
13051301
}
13061302

1307-
return ret;
1303+
// Return success as long as we managed to create a listening port
1304+
// for at least one protocol.
1305+
return ipv4 || ipv6;
13081306
}
13091307

13101308
static bool server_sockets(bool management) {

0 commit comments

Comments
 (0)