[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: How can a module intentionally fail to load?
- From: Sean Conner <sean@...>
- Date: Mon, 6 Aug 2018 22:32:09 -0400
I'm working on two modules, both related to libtls [1]. The first one is
just a C wrapper around libtls (which is done for the most part), and I
thought it would be nice to support as many versions as possible.
The second module is a Lua module (or rather, a collection of modules)
that handle TLS (or TCP) connections via coroutines---each connection is
wrapped up in a coroutine and there's a main event loop that schedules
everything. This one too, is mostly done.
Enough of the background, now the problem. The Lua module will only work
with libtls 2.5.0 (the earliest version that supports user-controlled
sockets). It's not enough that, say, org.conman.tls exists, but unless it
was compiled against libtls 2.5.0 (or higher), it won't work. I'm looking
for something like:
-----[ my-tls.lua / loaded as a module ]----
local tls = require "org.conman.tls"
if tls.LIBRESSL_VERSION < 0x2050000f then
??? there's no point in continuing with loading
??? this module, because libtls will not let us
??? control the socket.
end
How to I abort the module? There's nothing I can find in the
documentation to deal with this, unless I'm missing something.
-spc
[1] I started this with the latest version and got it working. Now I'm
working backwards, supporting earlier verions of the library.