lua-handlers
lua-handlers copied to clipboard
lua-handlers + udp with nixio+ev on freebsd problem - SO_REUSEPORT
I'm testing a bit with the poller branch and udp (i need COAP support). While testing it on FreeBSD i got into trouble with the server mentioning "Adress already in use". This is caused by acceptor/nixio_backend.lua at ~ line 115 where the :bind() is happening.
It took some time until i realized that there isn't only SO_REUSEADDR but also SO_REUSEPORT on FreeBSD - this seems to be needed.
I tried this modifing nixio 0.3/src/sockopt.c adding
} else if (!strcmp(option, "reuseport")) {
return nixio__gso_int(L, sock->fd, SOL_SOCKET, SO_REUSEPORT, set);
and then, also added it to acceptor/nxio_backend.lua next to the 'reuseaddr' calls.
It's working now in my test environment but how should we handle this? This means a patch to lua-handlers and nixio. Should i create a PR for both?
Yes. a PR to both. Make sure to use #ifdef/#else/#endif like what is done for SO_PRIORITY