Github user jablko commented on a diff in the pull request:
https://github.com/apache/trafficserver/pull/1294#discussion_r94838912
--- Diff: iocore/net/BIO_fastopen.cc ---
@@ -160,9 +174,24 @@ static const BIO_METHOD fastopen_methods = {
.destroy = fastopen_destroy,
.callback_ctrl = nullptr,
};
+#else
+static BIO_METHOD *fastopen_methods = nullptr;
+#endif
const BIO_METHOD *
BIO_s_fastopen()
{
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
return &fastopen_methods;
+#else
+ if (!fastopen_methods) {
+ fastopen_methods = BIO_meth_new(BIO_TYPE_SOCKET, "fastopen");
+ BIO_meth_set_write(fastopen_methods, fastopen_bwrite);
+ BIO_meth_set_read(fastopen_methods, fastopen_bread);
+ BIO_meth_set_ctrl(fastopen_methods, fastopen_ctrl);
+ BIO_meth_set_create(fastopen_methods, fastopen_create);
+ BIO_meth_set_destroy(fastopen_methods, fastopen_destroy);
--- End diff --
Is the following equivalent?
```C
#if OPENSSL_VERSION_NUMBER < 0x10100000L
static const BIO_METHOD fastopen_methods[] = {{
...
}};
#else
static const BIO_METHOD *fastopen_methods = [] {
BIO_METHOD *fastopen_methods = BIO_meth_new(BIO_TYPE_SOCKET, "fastopen");
...
return fastopen_methods;
}();
#endif
const BIO_METHOD *
BIO_s_fastopen()
{
return fastopen_methods;
}
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---