fix: check uv_is_closing before uv_close

This commit is contained in:
shenglian zhou 2023-04-11 13:24:20 +08:00
parent 6b68a373e9
commit 74f2ba76a4
1 changed files with 6 additions and 3 deletions

View File

@ -1400,9 +1400,10 @@ void udfcUvHandleError(SClientUvConn *conn) {
QUEUE_REMOVE(&task->procTaskQueue); QUEUE_REMOVE(&task->procTaskQueue);
uv_sem_post(&task->taskSem); uv_sem_post(&task->taskSem);
} }
if (!uv_is_closing(conn->pipe)) {
uv_close((uv_handle_t *)conn->pipe, onUdfcPipeClose); uv_close((uv_handle_t *)conn->pipe, onUdfcPipeClose);
} }
}
void onUdfcPipeRead(uv_stream_t *client, ssize_t nread, const uv_buf_t *buf) { void onUdfcPipeRead(uv_stream_t *client, ssize_t nread, const uv_buf_t *buf) {
fnDebug("udfc client %p, client read from pipe. nread: %zd", client, nread); fnDebug("udfc client %p, client read from pipe. nread: %zd", client, nread);
@ -1553,7 +1554,9 @@ int32_t udfcStartUvTask(SClientUvTaskNode *uvTask) {
} else { } else {
SClientUvConn *conn = pipe->data; SClientUvConn *conn = pipe->data;
QUEUE_INSERT_TAIL(&conn->taskQueue, &uvTask->connTaskQueue); QUEUE_INSERT_TAIL(&conn->taskQueue, &uvTask->connTaskQueue);
if (!uv_is_closing(uvTask->pipe)) {
uv_close((uv_handle_t *)uvTask->pipe, onUdfcPipeClose); uv_close((uv_handle_t *)uvTask->pipe, onUdfcPipeClose);
}
code = 0; code = 0;
} }
break; break;