-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes to require, loadlib and UdpServer #396
base: main
Are you sure you want to change the base?
Conversation
@@ -56,39 +57,57 @@ void dump_network() | |||
void udp_data(sockpp::udp_socket socket, UdpServer* server) | |||
{ | |||
ssize_t n; | |||
char buf[500]; | |||
static char buf[32768]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't this be thread_local
?
-- Save messages to queue instead of printing directly, cause that doesn't work from the server thread | ||
queue = {}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you though about making safe version of udp_listen
? so people don't have to worry about it being on different thread
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe instead of callback, having a function that you can use to request the current buffer of messages
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have actually made exactly that locally already, but haven't pushed it cause there's also a bunch of tcp stuff that doesn't work at all.
It was recently brought back to my attention that loading DLLs with
require
simply didn't work at all, andloadlib
could only load them from the game root.require
from the mod folderpackage.loadlib
from the mod folderrequire
on built-in libraries just setting them to nilUdpServer:close()
(and garbage collection by nil) to close serversUdpServer:open()
andUdpServer:error()
to check what went wrongThis should allow things like the archipelago mod to simply
require "apclientpp"
whenapclientpp.dll
is vendored with the mod, instead of all the extra steps when installing it.The following also seem to work for example, when a complete luasocket build is provided to the mod dir: