luasocket
luasocket copied to clipboard
Move #define WAITFD_* to .h
Hey Bruno. I am about to merge this pull request. There is another pull request by @horazont, #72 that is very related. His idea is to publish some additional symbols from LuaSocket so LuaSec can use them when loaded in the same process, rather than replicating the functionality. What do you think about that idea?
Hi Diego,
luasec imported some files from luasocket to deal with sockets and offer the same API for buffer. If some symbols from luasocket could be exported, it is possible to reuse luasocket as a library for luasec.
See: http://www.inf.ufg.br/~brunoos/luasec/light/
This was an experiment for 0.4, but the "dev" version of luasec has a build flag, you can choose to use the imported files from luasocket or link against "luasocket-lib".
Do you know the minimal set of functions to be exported?
I think these are the functions:
ssl.c:266: buffer_init ssl.c:278: buffer_meth_send ssl.c:286: buffer_meth_receive ssl.c:294: buffer_meth_getstats ssl.c:302: buffer_meth_setstats ssl.c:372: buffer_isempty
ssl.c:263: io_init
ssl.c:62: socket_strerror ssl.c:72: socket_setblocking ssl.c:76: socket_destroy ssl.c:110: socket_waitfd ssl.c:325: socket_setnonblocking ssl.c:753: socket_open
ssl.c:98: timeout_markstart ssl.c:265: timeout_init ssl.c:361: timeout_meth_settimeout
Should I prefix all symbols with ls_ or something, and mark these with LUASOCKET_API?
It could be good to avoid name clash. For now, it does not cause any trouble for luasec.
Regarding the name clashes / prefix discussion:
I just looked at the FreeBSD luasocket port - that one patches all of these methods with a prefix. The explanation in the commit over there:
- namespace clash with www/lighttpd mod_magnet
upstream is gone, but the port is still quite useful
That's from August 2010 and the latest bump (FreeBSD is updating to 3.0rc1 ~now~) will keep that patch. If you'd agree to take that upstream that'd be amazing. I could prepare a patch for that (based on the FreeBSD one..) if you're okay with that.
I don't have a problem prefixing all exported symbols with "ls" and making sure the symbols needed by LuaSec are exported. Can you prepare a patch addressing both issues?
Hello. Any news about this feature?
Any news here?
Does anybody understand what happened here or better yet what needs to happen?
@winterheart ^^
Well since then I've opened PR #346 with some fixes for original idea. That implementation already ported into Gentoo Linux luasocket package and used by luasec package. So I'd recommend move conversations there.