If `tcpFastOpen` is set on a backend, we used to skip the
`connect()` call regardless of `MSG_FASTOPEN` availability.
We then tried to call `sendmsg()` (without `MSG_FASTOPEN`)
on an unconnected TCP socket, which failed.
}
if(vars.count("tcpFastOpen")) {
- ret->tcpFastOpen=boost::get<bool>(vars["tcpFastOpen"]);
+ bool fastOpen = boost::get<bool>(vars["tcpFastOpen"]);
+ if (fastOpen) {
+#ifdef MSG_FASTOPEN
+ ret->tcpFastOpen=true;
+#else
+ warnlog("TCP Fast Open has been configured on downstream server %s but is not supported", boost::get<string>(vars["address"]));
+#endif
+ }
}
if(vars.count("name")) {
SBind(sock, ds->sourceAddr);
}
setNonBlocking(sock);
+#ifdef MSG_FASTOPEN
if (!ds->tcpFastOpen) {
SConnectWithTimeout(sock, ds->remote, ds->tcpConnectTimeout);
}
+#else
+ SConnectWithTimeout(sock, ds->remote, ds->tcpConnectTimeout);
+#endif /* MSG_FASTOPEN */
return sock;
}
catch(const std::runtime_error& e) {