Merge pull request #17603 from taosdata/fix/avoidTransQuit
avoid invalid read/write
This commit is contained in:
commit
848fa688eb
|
@ -148,14 +148,22 @@ static FORCE_INLINE void clientRecvCb(uv_stream_t* handle, ssize_t nread, const
|
|||
} else {
|
||||
uTrace("http-report succ to recv %d bytes", (int32_t)nread);
|
||||
}
|
||||
if (!uv_is_closing((uv_handle_t*)&cli->tcp)) {
|
||||
uv_close((uv_handle_t*)&cli->tcp, clientCloseCb);
|
||||
} else {
|
||||
destroyHttpClient(cli);
|
||||
}
|
||||
}
|
||||
static void clientSentCb(uv_write_t* req, int32_t status) {
|
||||
SHttpClient* cli = req->data;
|
||||
if (status != 0) {
|
||||
terrno = TAOS_SYSTEM_ERROR(status);
|
||||
uError("http-report failed to send data %s", uv_strerror(status));
|
||||
if (!uv_is_closing((uv_handle_t*)&cli->tcp)) {
|
||||
uv_close((uv_handle_t*)&cli->tcp, clientCloseCb);
|
||||
} else {
|
||||
destroyHttpClient(cli);
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
uTrace("http-report succ to send data");
|
||||
|
@ -176,7 +184,11 @@ static void clientConnCb(uv_connect_t* req, int32_t status) {
|
|||
if (status != 0) {
|
||||
terrno = TAOS_SYSTEM_ERROR(status);
|
||||
uError("http-report failed to conn to server, reason:%s, dst:%s:%d", uv_strerror(status), cli->addr, cli->port);
|
||||
if (!uv_is_closing((uv_handle_t*)&cli->tcp)) {
|
||||
uv_close((uv_handle_t*)&cli->tcp, clientCloseCb);
|
||||
} else {
|
||||
destroyHttpClient(cli);
|
||||
}
|
||||
return;
|
||||
}
|
||||
status = uv_write(&cli->req, (uv_stream_t*)&cli->tcp, cli->wbuf, 2, clientSentCb);
|
||||
|
|
Loading…
Reference in New Issue