@@ -30,7 +30,6 @@ struct WebsocketContext
3030{
3131 uint64_t m_BufferSize;
3232 int m_Timeout;
33- int m_ReceiveTimeout;
3433 dmArray<WebsocketConnection*> m_Connections;
3534 dmConnectionPool::HPool m_Pool;
3635 uint32_t m_Initialized:1 ;
@@ -271,10 +270,13 @@ static void ConnectionWorker(void* _conn)
271270 conn->m_SSLSocket = dmConnectionPool::GetSSLSocket (g_Websocket.m_Pool , conn->m_Connection );
272271 dmSocket::SetNoDelay (conn->m_Socket , true );
273272 dmSocket::SetBlocking (conn->m_Socket , false );
274- dmSocket::SetReceiveTimeout (conn->m_Socket , g_Websocket.m_ReceiveTimeout );
273+ // Don't go lower than 1000 microseconds since this value will be divided by 1000
274+ // in the socket code and we'll then get a timeout of 0 which means the socket
275+ // will block indefinitely
276+ dmSocket::SetReceiveTimeout (conn->m_Socket , 1000 );
275277 if (conn->m_SSLSocket )
276278 {
277- dmSSLSocket::SetReceiveTimeout (conn->m_SSLSocket , g_Websocket. m_ReceiveTimeout );
279+ dmSSLSocket::SetReceiveTimeout (conn->m_SSLSocket , 1000 );
278280 }
279281
280282 // send handshake
@@ -714,11 +716,6 @@ static dmExtension::Result AppInitialize(dmExtension::AppParams* params)
714716 g_Websocket.m_Pool = 0 ;
715717 g_Websocket.m_Initialized = 0 ;
716718
717- // do not go below 1000 microseconds since the value is divided by 1000
718- // in dmSocket
719- // this will result in a timeout of 0 which blocks indefinitely
720- g_Websocket.m_ReceiveTimeout = dmMath::Max (1000 , dmConfigFile::GetInt (params->m_ConfigFile , " websocket.receive_timeout" , 1000 ));
721-
722719 dmConnectionPool::Params pool_params;
723720 pool_params.m_MaxConnections = dmConfigFile::GetInt (params->m_ConfigFile , " websocket.max_connections" , 2 );
724721 dmConnectionPool::Result result = dmConnectionPool::New (&pool_params, &g_Websocket.m_Pool );
0 commit comments