Multiple test fixes.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3874 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
parent
7848b5e560
commit
b688a89b66
@ -162,21 +162,20 @@ static void _file_write_write_callback(uv_fs_t* req)
|
||||
|
||||
static void _file_write_open_callback(uv_fs_t* req)
|
||||
{
|
||||
fs_req_t* fsreq = (fs_req_t*)req;
|
||||
uv_fs_req_cleanup(req);
|
||||
tf_task_t* task = req->loop->data;
|
||||
JSContext* context = tf_task_get_context(task);
|
||||
promiseid_t promise = (promiseid_t)(intptr_t)req->data;
|
||||
if (req->result >= 0)
|
||||
{
|
||||
size_t size = 0;
|
||||
memcpy(&size, req + 1, sizeof(size));
|
||||
uv_buf_t buf = { .base = (char*)(req + 1) + sizeof(size), .len = size };
|
||||
uv_file file = req->result;
|
||||
int result = uv_fs_write(req->loop, req, file, &buf, 1, 0, _file_write_write_callback);
|
||||
uv_buf_t buf = { .base = fsreq->buffer, .len = fsreq->size };
|
||||
fsreq->file = req->result;
|
||||
int result = uv_fs_write(req->loop, req, fsreq->file, &buf, 1, 0, _file_write_write_callback);
|
||||
if (result < 0)
|
||||
{
|
||||
tf_task_reject_promise(task, promise, JS_ThrowInternalError(context, uv_strerror(result)));
|
||||
result = uv_fs_close(req->loop, req, file, _file_async_close_callback);
|
||||
result = uv_fs_close(req->loop, req, fsreq->file, _file_async_close_callback);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -592,11 +592,18 @@ void _socket_shutdownInternal(socket_t* socket, promiseid_t promise)
|
||||
|
||||
void _socket_processTlsShutdown(socket_t* socket, promiseid_t promise)
|
||||
{
|
||||
tf_tls_session_shutdown(socket->_tls);
|
||||
if (!_socket_processSomeOutgoingTls(socket, promise, _socket_onTlsShutdown))
|
||||
if (!socket->_tls)
|
||||
{
|
||||
_socket_shutdownInternal(socket, promise);
|
||||
}
|
||||
else
|
||||
{
|
||||
tf_tls_session_shutdown(socket->_tls);
|
||||
if (!_socket_processSomeOutgoingTls(socket, promise, _socket_onTlsShutdown))
|
||||
{
|
||||
_socket_shutdownInternal(socket, promise);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void _socket_onTlsShutdown(uv_write_t* request, int status)
|
||||
|
@ -258,9 +258,22 @@ static void _taskstub_cleanup(tf_taskstub_t* stub)
|
||||
static void _taskstub_finalizer(JSRuntime* runtime, JSValue value)
|
||||
{
|
||||
tf_taskstub_t* stub = JS_GetOpaque(value, _classId);
|
||||
stub->_on_exit = JS_UNDEFINED;
|
||||
stub->_on_error = JS_UNDEFINED;
|
||||
stub->_on_print = JS_UNDEFINED;
|
||||
JSContext* context = tf_task_get_context(stub->_owner);
|
||||
if (!JS_IsUndefined(stub->_on_exit))
|
||||
{
|
||||
JS_FreeValue(context, stub->_on_exit);
|
||||
stub->_on_exit = JS_UNDEFINED;
|
||||
}
|
||||
if (!JS_IsUndefined(stub->_on_error))
|
||||
{
|
||||
JS_FreeValue(context, stub->_on_error);
|
||||
stub->_on_error = JS_UNDEFINED;
|
||||
}
|
||||
if (!JS_IsUndefined(stub->_on_print))
|
||||
{
|
||||
JS_FreeValue(context, stub->_on_print);
|
||||
stub->_on_print = JS_UNDEFINED;
|
||||
}
|
||||
tf_packetstream_destroy(stub->_stream);
|
||||
stub->_stream = NULL;
|
||||
stub->_finalized = true;
|
||||
|
Loading…
Reference in New Issue
Block a user