I just realized that my error function was wrong, a case of not doing what I expected
so when it was getting The #TLS_WANT_POLLIN and POLLOut it wasn't checking them and they simply came back with 0 as the functions tls_write tls_read will have likely already cleared the error which would be an Eagain
dyslexia sucks I've been looking at it the whole time thinking it's right but I need to pass in the result as well as the connection ID.
Your problems sound very similar to what I'm seeing on windows with x86 backend, in my reverse proxy function
it literally hangs on a file and locks up the thread, x64 has no issues but I also had the issues with the function on linux.
I'm also using sendnetworkstring in the function so that is worth checking out incase it's not dealing with the errors properly due to changes with the TLS.
I've got my reverse proxy working again on x86 but I'm somewhat confused as I'm still getting resets to the errno, which aren't TLS want pollin or pollout, so maybe I need to rearrange and check the error immediately, you'd think after 30 or 40 years it'd be possible to make a thread safe error that's not subject to race conditions.
Still after half a day I'm still clueless what the cause is of getting the 0 return from the error look up but as far as the reverse proxy and server goes it's working fine.
https://www.purebasic.fr/english/viewtopic.php?t=86576