Run DNS lookup in a separate thread (#37)

* Moved connection pool dial to a thread
* Make sure to join the thread when done
* Cleanup in AppInitialize. Early exit if pool creation failed.
* Only check connection timeout for emscripten
This commit is contained in:
Björn Ritzl
2021-03-17 12:59:01 +01:00
committed by GitHub
parent 4e67c4dfaa
commit cba11de5f1
2 changed files with 38 additions and 25 deletions

View File

@@ -24,6 +24,7 @@
#include <dmsdk/dlib/dns.h>
#include <dmsdk/dlib/uri.h>
#include <dmsdk/dlib/array.h>
#include <dmsdk/dlib/thread.h>
namespace dmCrypt
{
@@ -118,6 +119,7 @@ namespace dmWebsocket
dmConnectionPool::HConnection m_Connection;
dmSocket::Socket m_Socket;
dmSSLSocket::Socket m_SSLSocket;
dmThread::Thread m_ConnectionThread;
dmArray<Message> m_Messages; // lengths of the messages in the data buffer
uint64_t m_ConnectTimeout;
uint8_t m_Key[16];