SocketAddress address;
address.setFromLocalAddress(fd);
+#if __linux__
+ if (noTransparentTls_) {
+ // Ignore return value, errors are ok
+ setsockopt(fd, SOL_SOCKET, SO_NO_TRANSPARENT_TLS, nullptr, 0);
+ }
+#endif
+
setupSocket(fd, address.getFamily());
sockets_.emplace_back(eventBase_, fd, this, address.getFamily());
sockets_.back().changeHandlerFD(fd);
sockaddr_storage addrStorage;
address.getAddress(&addrStorage);
sockaddr* saddr = reinterpret_cast<sockaddr*>(&addrStorage);
+
if (fsp::bind(fd, saddr, address.getActualSize()) != 0) {
if (!isExistingSocket) {
closeNoInt(fd);
address.describe());
}
+#if __linux__
+ if (noTransparentTls_) {
+ // Ignore return value, errors are ok
+ setsockopt(fd, SOL_SOCKET, SO_NO_TRANSPARENT_TLS, nullptr, 0);
+ }
+#endif
+
// If we just created this socket, update the EventHandler and set socket_
if (!isExistingSocket) {
sockets_.emplace_back(eventBase_, fd, this, address.getFamily());
SocketAddress::getFamilyNameFrom(res->ai_addr, "<unknown>"));
}
+#if __linux__
+ if (noTransparentTls_) {
+ // Ignore return value, errors are ok
+ setsockopt(s, SOL_SOCKET, SO_NO_TRANSPARENT_TLS, nullptr, 0);
+ }
+#endif
+
SocketAddress address;
address.setFromLocalAddress(s);
#define SO_REUSEPORT 15
#endif
+#if defined __linux__ && !defined SO_NO_TRANSPARENT_TLS
+#define SO_NO_TRANSPARENT_TLS 200
+#endif
+
namespace folly {
/**
tfoMaxQueueSize_ = maxTFOQueueSize;
}
+ /**
+ * Do not attempt the transparent TLS handshake
+ */
+ void disableTransparentTls() {
+ noTransparentTls_ = true;
+ }
+
/**
* Get whether or not the socket is accepting new connections
*/
bool reusePortEnabled_{false};
bool closeOnExec_;
bool tfo_{false};
+ bool noTransparentTls_{false};
uint32_t tfoMaxQueueSize_{0};
ShutdownSocketSet* shutdownSocketSet_;
ConnectionEventCallback* connectionEventCallback_{nullptr};