nitely / nim-hyperx

Pure Nim http2 client and server 🖖
MIT License
23 stars 0 forks source link

Allow running client/server in a child thread. #7

Open nitely opened 1 month ago

nitely commented 1 month ago

Right now the SSL context is stored in a thread var, and destroyed at program exit. This means if client/server is used in a child thread, the SSL will not be destroyed when the thread terminates, so it should leak. It probably also crashes at program exit with a SIGSEGV when it tries to destroy the SSL context.

One way to fix this is store a ref in the server and client context and destroy it on close, or offer a way to avoid destroy the thread var at program exit, and to manually destroy it before the thread terminates, or add a destructor (this is the best if possible).

Unless addExitProc callbacks are called at child thread exit. If so, then everything should work fine, and this issue can be closed.

Assuming asyncdispatch supports this in the first place.