Another leak.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3913 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
parent
515999e570
commit
b5c6cac048
@ -237,7 +237,12 @@ function handleWebSocketRequest(request, response, client) {
|
|||||||
var array = new Uint8Array(packet.length + message.length);
|
var array = new Uint8Array(packet.length + message.length);
|
||||||
array.set(packet, 0);
|
array.set(packet, 0);
|
||||||
array.set(message, packet.length);
|
array.set(message, packet.length);
|
||||||
return client.write(array);
|
try {
|
||||||
|
return client.write(array);
|
||||||
|
} catch (error) {
|
||||||
|
client.close();
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
response.onMessage = null;
|
response.onMessage = null;
|
||||||
|
|
||||||
|
@ -891,13 +891,19 @@ int _socket_writeInternal(socket_t* socket, promiseid_t promise, const char* dat
|
|||||||
uv_write_t* request = (uv_write_t*)rawBuffer;
|
uv_write_t* request = (uv_write_t*)rawBuffer;
|
||||||
memcpy(rawBuffer + sizeof(uv_write_t), data, length);
|
memcpy(rawBuffer + sizeof(uv_write_t), data, length);
|
||||||
|
|
||||||
uv_buf_t buffer = {
|
uv_buf_t buffer =
|
||||||
|
{
|
||||||
.base = rawBuffer + sizeof(uv_write_t),
|
.base = rawBuffer + sizeof(uv_write_t),
|
||||||
.len = length,
|
.len = length,
|
||||||
};
|
};
|
||||||
|
|
||||||
request->data = (void*)(intptr_t)promise;
|
request->data = (void*)(intptr_t)promise;
|
||||||
return uv_write(request, (uv_stream_t*)&socket->_socket, &buffer, 1, _socket_onWrite);
|
int result = uv_write(request, (uv_stream_t*)&socket->_socket, &buffer, 1, _socket_onWrite);
|
||||||
|
if (result != 0)
|
||||||
|
{
|
||||||
|
tf_free(rawBuffer);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _socket_write_tls(socket_t* socket, promiseid_t promise, const char* data, size_t size)
|
static int _socket_write_tls(socket_t* socket, promiseid_t promise, const char* data, size_t size)
|
||||||
|
Loading…
Reference in New Issue
Block a user