Github user jablko commented on a diff in the pull request:
https://github.com/apache/trafficserver/pull/1294#discussion_r94481428
--- Diff: iocore/net/BIO_fastopen.cc ---
@@ -27,13 +27,26 @@
#include "BIO_fastopen.h"
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#define BIO_set_data(a, ptr) ((a)->ptr = (ptr))
+#define BIO_get_data(a) ((a)->ptr)
+#define BIO_set_init(a, init) ((a)->init = (init))
+#define BIO_set_shutdown(a, shut) ((a)->shutdown = (shut))
+#define BIO_get_shutdown(a) ((a)->shutdown)
+#endif
+
+struct Data {
+ Data() : fd(NO_FD), dst(nullptr) {}
+ int fd;
+ const sockaddr *dst;
+};
+
static int
fastopen_create(BIO *bio)
{
- bio->init = 0;
- bio->num = NO_FD;
- bio->flags = 0;
- bio->ptr = nullptr;
+ Data *data = new Data;
--- End diff --
Right, previously we stashed the file descriptor in bio->num and the
destination address in bio->ptr, but now BIO is opaque and I found no way to
access bio->num anymore -- so I think I now need to stash both in bio->ptr?
Good thinking re: an existing data structure, however I think we get the
file descriptor and destination address via separate calls to fastopen_ctrl(),
so I don't know if that's feasible, even if a candidate structure exists?
I understand why bio->num and bio->ptr needed to be initialized in
fastopen_create(). I assumed initializing them again in fastopen_destroy() (by
calling fastopen_create()) was just defensive coding? Now that deallocation is
involved, I'm not sure what the right thing to is. "delete data", I guess? or
something more/else?
---
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.
---