mirror of
https://github.com/defold/extension-websocket.git
synced 2025-06-27 01:47:42 +02:00
always call lua callback when connection goes to STATE_DISCONNECTED (#28)
This commit is contained in:
parent
f988413a74
commit
39abd7cdea
@ -195,7 +195,6 @@ static WebsocketConnection* CreateConnection(const char* url)
|
||||
conn->m_SSLSocket = 0;
|
||||
conn->m_Status = RESULT_OK;
|
||||
conn->m_HasHandshakeData = 0;
|
||||
conn->m_WasConnected = 0;
|
||||
|
||||
#if defined(HAVE_WSLAY)
|
||||
conn->m_Ctx = 0;
|
||||
@ -572,10 +571,7 @@ static dmExtension::Result OnUpdate(dmExtension::Params* params)
|
||||
conn->m_BufferSize = 0;
|
||||
}
|
||||
|
||||
if (conn->m_WasConnected)
|
||||
{
|
||||
HandleCallback(conn, EVENT_DISCONNECTED, 0, conn->m_BufferSize);
|
||||
}
|
||||
|
||||
g_Websocket.m_Connections.EraseSwap(i);
|
||||
--i;
|
||||
@ -682,7 +678,6 @@ static dmExtension::Result OnUpdate(dmExtension::Params* params)
|
||||
#endif
|
||||
dmSocket::SetBlocking(conn->m_Socket, false);
|
||||
|
||||
conn->m_WasConnected = 1;
|
||||
SetState(conn, STATE_CONNECTED);
|
||||
HandleCallback(conn, EVENT_CONNECTED, 0, 0);
|
||||
}
|
||||
|
@ -100,8 +100,7 @@ namespace dmWebsocket
|
||||
Result m_Status;
|
||||
uint8_t m_SSL:1;
|
||||
uint8_t m_HasHandshakeData:1;
|
||||
uint8_t m_WasConnected:1;
|
||||
uint8_t :6;
|
||||
uint8_t :7;
|
||||
};
|
||||
|
||||
// Set error message
|
||||
|
Loading…
x
Reference in New Issue
Block a user