luasocket icon indicating copy to clipboard operation
luasocket copied to clipboard

Move #define WAITFD_* to .h

Open brunoos opened this issue 11 years ago • 13 comments

brunoos avatar Sep 12 '13 12:09 brunoos

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?

diegonehab avatar Sep 12 '13 16:09 diegonehab

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".

brunoos avatar Sep 12 '13 17:09 brunoos

Do you know the minimal set of functions to be exported?

diegonehab avatar Sep 12 '13 17:09 diegonehab

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

brunoos avatar Sep 16 '13 16:09 brunoos

Should I prefix all symbols with ls_ or something, and mark these with LUASOCKET_API?

diegonehab avatar Sep 16 '13 19:09 diegonehab

It could be good to avoid name clash. For now, it does not cause any trouble for luasec.

brunoos avatar Sep 17 '13 00:09 brunoos

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.

darklajid avatar Feb 11 '14 12:02 darklajid

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?

diegonehab avatar Feb 12 '14 00:02 diegonehab

Hello. Any news about this feature?

winterheart avatar Jul 07 '20 10:07 winterheart

Any news here?

ConiKost avatar Feb 06 '21 16:02 ConiKost

Does anybody understand what happened here or better yet what needs to happen?

alerque avatar Nov 08 '23 11:11 alerque

@winterheart ^^

ConiKost avatar Nov 11 '23 01:11 ConiKost

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.

winterheart avatar Nov 17 '23 22:11 winterheart