[mac] Fix compilation on macOS
Commit fbde2371 broke the build on macOS with the following error:
`error: use of undeclared identifier 'SO_DOMAIN’`
This patch fixes the build by disabling the use of `SO_DOMAIN`
to disable `TCP_CORK` in the case of an `AF_UNIX` socket on
macOS.
Change-Id: I815421a7531136c6a7c468b1664221cfc5ea5df1
Reviewed-on: http://gerrit.cloudera.org:8080/15771
Tested-by: Kudu Jenkins
Reviewed-by: Alexey Serbin <aserbin@cloudera.com>
diff --git a/src/kudu/security/tls_socket.cc b/src/kudu/security/tls_socket.cc
index 8f84c3f..cd67b7a 100644
--- a/src/kudu/security/tls_socket.cc
+++ b/src/kudu/security/tls_socket.cc
@@ -45,6 +45,10 @@
: Socket(fd),
ssl_(std::move(ssl)) {
use_cork_ = true;
+
+#ifndef __APPLE__
+// `SO_DOMAIN` is not available on macOS. This code can be safely
+// skipped because SetTcpCork() is a no-op on macOS.
if (fd >= 0) {
int dom;
socklen_t len = sizeof(dom);
@@ -53,6 +57,7 @@
use_cork_ = false;
}
}
+#endif
}
TlsSocket::~TlsSocket() {