mirror of
https://github.com/defold/extension-websocket.git
synced 2025-06-27 01:47:42 +02:00
moved error checking code outside of socket implementation
This commit is contained in:
parent
bd8569f49a
commit
274f29d7e4
@ -56,9 +56,7 @@ dmSocket::Result Receive(WebsocketConnection* conn, void* buffer, int length, in
|
||||
sr = dmSocket::Receive(conn->m_Socket, buffer, length, received_bytes);
|
||||
|
||||
int num_bytes = received_bytes ? (uint32_t)*received_bytes : 0;
|
||||
if (sr == dmSocket::RESULT_OK && num_bytes == 0)
|
||||
return dmSocket::RESULT_CONNABORTED;
|
||||
if (sr == dmSocket::RESULT_OK)
|
||||
if (sr == dmSocket::RESULT_OK && num_bytes > 0)
|
||||
DebugPrint(2, "Received bytes:", buffer, num_bytes);
|
||||
|
||||
return sr;
|
||||
|
@ -86,7 +86,7 @@ ssize_t WSL_RecvCallback(wslay_event_context_ptr ctx, uint8_t *buf, size_t len,
|
||||
dmSocket::Result socket_result = Receive(conn, buf, len, &r);
|
||||
|
||||
if (dmSocket::RESULT_OK == socket_result && r == 0)
|
||||
socket_result = dmSocket::RESULT_WOULDBLOCK;
|
||||
socket_result = dmSocket::RESULT_CONNABORTED;
|
||||
|
||||
if (dmSocket::RESULT_OK != socket_result)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user