Closed V10lator closed 3 years ago
I've created a branch: https://github.com/devkitPro/wut/tree/socket-init
This branch makes it possible to call socket_lib_init/finalize again, which now performs refcounting and handles devoptab registration/etc. However, the main addition is the ability to override the socket initialization/deinitialization logic, so that it can be customized to do things such as setting up somemopt. E.g.
void __init_wut_socket()
{
socket_lib_init();
// somemopt thread creation goes here
// wait for somemopt to be initialized? dunno how that's done
// AC initialization/connection goes here
}
void __fini_wut_socket()
{
// AC deinitialization goes here
socket_lib_finish();
// somemopt thread teardown goes here
}
Please test this branch, and see if the changes suit your use case.
See https://github.com/devkitPro/wut/commit/eb0306184d46a63d929aede352f54109701b7112
socket_lib_init/finish are no longer stubs.
If one calls somemopt the homebrew will never be able to exit as somemopt blocks untill socket_lib_finish is called which can't be done if said function is replaced by a stub.
Now you might ask "why call somemopt in the first place?" - the answer is simple: Performance reasons. You'll get much faster up-/downloads by using I/O buffers in userspace and the way to set these buffers is somemopt (socket memory option).
Example code to show the issue: