Oops. This caused a double-reject.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4135 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
Cory McWilliams 2023-01-18 23:14:44 +00:00
parent ce6cc82d64
commit e05302ac99

View File

@ -899,8 +899,7 @@ int _socket_writeInternal(socket_t* socket, promiseid_t promise, const char* dat
{
if (!socket->_socket.data)
{
tf_task_reject_promise(socket->_task, promise, JS_ThrowInternalError(tf_task_get_context(socket->_task), "uv_write: %s", "not connected"));
return -1;
return UV_ENOTCONN;
}
char* rawBuffer = tf_malloc(sizeof(uv_write_t) + length);
@ -917,7 +916,6 @@ int _socket_writeInternal(socket_t* socket, promiseid_t promise, const char* dat
int result = uv_write(request, (uv_stream_t*)&socket->_socket, &buffer, 1, _socket_onWrite);
if (result != 0)
{
tf_task_reject_promise(socket->_task, promise, JS_ThrowInternalError(tf_task_get_context(socket->_task), "uv_write: %s", uv_strerror(result)));
tf_free(rawBuffer);
}
return result;