remove assert
This commit is contained in:
parent
d0669151af
commit
cac4cb12e6
|
@ -39,7 +39,8 @@ static void idxGenLRUKey(char* buf, const char* path, int32_t blockId) {
|
|||
}
|
||||
static int idxFileCtxDoWrite(IFileCtx* ctx, uint8_t* buf, int len) {
|
||||
if (ctx->type == TFILE) {
|
||||
assert(len == taosWriteFile(ctx->file.pFile, buf, len));
|
||||
int nwr = taosWriteFile(ctx->file.pFile, buf, len);
|
||||
assert(nwr == len);
|
||||
} else {
|
||||
memcpy(ctx->mem.buf + ctx->offset, buf, len);
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "taoserror.h"
|
||||
#include "tlog.h"
|
||||
|
||||
// clang-format on
|
||||
|
||||
#define HTTP_RECV_BUF_SIZE 1024
|
||||
|
||||
|
@ -29,7 +30,7 @@ typedef struct SHttpClient {
|
|||
uv_tcp_t tcp;
|
||||
uv_write_t req;
|
||||
uv_buf_t* wbuf;
|
||||
char *rbuf;
|
||||
char* rbuf;
|
||||
char* addr;
|
||||
uint16_t port;
|
||||
} SHttpClient;
|
||||
|
@ -130,18 +131,17 @@ static void destroyHttpClient(SHttpClient* cli) {
|
|||
taosMemoryFree(cli->rbuf);
|
||||
taosMemoryFree(cli->addr);
|
||||
taosMemoryFree(cli);
|
||||
|
||||
}
|
||||
static void clientCloseCb(uv_handle_t* handle) {
|
||||
SHttpClient* cli = handle->data;
|
||||
destroyHttpClient(cli);
|
||||
}
|
||||
static void clientAllocBuffCb(uv_handle_t *handle, size_t suggested_size, uv_buf_t *buf) {
|
||||
static void clientAllocBuffCb(uv_handle_t* handle, size_t suggested_size, uv_buf_t* buf) {
|
||||
SHttpClient* cli = handle->data;
|
||||
buf->base = cli->rbuf;
|
||||
buf->len = HTTP_RECV_BUF_SIZE;
|
||||
}
|
||||
static void clientRecvCb(uv_stream_t* handle, ssize_t nread, const uv_buf_t *buf) {
|
||||
static void clientRecvCb(uv_stream_t* handle, ssize_t nread, const uv_buf_t* buf) {
|
||||
SHttpClient* cli = handle->data;
|
||||
if (nread < 0) {
|
||||
uError("http-report recv error:%s", uv_err_name(nread));
|
||||
|
@ -160,7 +160,7 @@ static void clientSentCb(uv_write_t* req, int32_t status) {
|
|||
} else {
|
||||
uTrace("http-report succ to send data");
|
||||
}
|
||||
uv_read_start((uv_stream_t *)&cli->tcp, clientAllocBuffCb, clientRecvCb);
|
||||
uv_read_start((uv_stream_t*)&cli->tcp, clientAllocBuffCb, clientRecvCb);
|
||||
}
|
||||
static void clientConnCb(uv_connect_t* req, int32_t status) {
|
||||
SHttpClient* cli = req->data;
|
||||
|
@ -233,4 +233,3 @@ int32_t taosSendHttpReport(const char* server, uint16_t port, char* pCont, int32
|
|||
uv_loop_close(loop);
|
||||
return terrno;
|
||||
}
|
||||
// clang-format on
|
||||
|
|
|
@ -906,23 +906,30 @@ static void uvDestroyConn(uv_handle_t* handle) {
|
|||
}
|
||||
}
|
||||
static void uvPipeListenCb(uv_stream_t* handle, int status) {
|
||||
ASSERT(status == 0);
|
||||
if (status != 0) {
|
||||
tError("server failed to init pipe");
|
||||
return;
|
||||
}
|
||||
|
||||
SServerObj* srv = container_of(handle, SServerObj, pipeListen);
|
||||
uv_pipe_t* pipe = &(srv->pipe[srv->numOfWorkerReady][0]);
|
||||
ASSERT(0 == uv_pipe_init(srv->loop, pipe, 1));
|
||||
ASSERT(0 == uv_accept((uv_stream_t*)&srv->pipeListen, (uv_stream_t*)pipe));
|
||||
|
||||
ASSERT(1 == uv_is_readable((uv_stream_t*)pipe));
|
||||
ASSERT(1 == uv_is_writable((uv_stream_t*)pipe));
|
||||
ASSERT(0 == uv_is_closing((uv_handle_t*)pipe));
|
||||
int ret = uv_pipe_init(srv->loop, pipe, 1);
|
||||
assert(ret == 0);
|
||||
|
||||
ret = uv_accept((uv_stream_t*)&srv->pipeListen, (uv_stream_t*)pipe);
|
||||
assert(ret == 0);
|
||||
|
||||
ret = uv_is_readable((uv_stream_t*)pipe);
|
||||
assert(ret == 1);
|
||||
|
||||
ret = uv_is_writable((uv_stream_t*)pipe);
|
||||
assert(ret == 1);
|
||||
|
||||
ret = uv_is_closing((uv_handle_t*)pipe);
|
||||
assert(ret == 0);
|
||||
|
||||
srv->numOfWorkerReady++;
|
||||
|
||||
// ASSERT(0 == uv_listen((uv_stream_t*)&ctx.send.tcp, 512, uvOnAcceptCb));
|
||||
|
||||
// r = uv_read_start((uv_stream_t*)&ctx.channel, alloc_cb, read_cb);
|
||||
// ASSERT(r == 0);
|
||||
}
|
||||
|
||||
void* transInitServer(uint32_t ip, uint32_t port, char* label, int numOfThreads, void* fp, void* shandle) {
|
||||
|
@ -937,7 +944,9 @@ void* transInitServer(uint32_t ip, uint32_t port, char* label, int numOfThreads,
|
|||
srv->port = port;
|
||||
uv_loop_init(srv->loop);
|
||||
|
||||
assert(0 == uv_pipe_init(srv->loop, &srv->pipeListen, 0));
|
||||
int ret = uv_pipe_init(srv->loop, &srv->pipeListen, 0);
|
||||
assert(ret == 0);
|
||||
|
||||
#ifdef WINDOWS
|
||||
char pipeName[64];
|
||||
snprintf(pipeName, sizeof(pipeName), "\\\\?\\pipe\\trans.rpc.%p-" PRIu64, taosSafeRand(), GetCurrentProcessId());
|
||||
|
@ -946,8 +955,11 @@ void* transInitServer(uint32_t ip, uint32_t port, char* label, int numOfThreads,
|
|||
snprintf(pipeName, sizeof(pipeName), "%s%spipe.trans.rpc.%08X-" PRIu64, tsTempDir, TD_DIRSEP, taosSafeRand(),
|
||||
taosGetSelfPthreadId());
|
||||
#endif
|
||||
assert(0 == uv_pipe_bind(&srv->pipeListen, pipeName));
|
||||
assert(0 == uv_listen((uv_stream_t*)&srv->pipeListen, SOMAXCONN, uvPipeListenCb));
|
||||
ret = uv_pipe_bind(&srv->pipeListen, pipeName);
|
||||
assert(ret == 0);
|
||||
|
||||
ret = uv_listen((uv_stream_t*)&srv->pipeListen, SOMAXCONN, uvPipeListenCb);
|
||||
assert(ret == 0);
|
||||
|
||||
for (int i = 0; i < srv->numOfThreads; i++) {
|
||||
SWorkThrd* thrd = (SWorkThrd*)taosMemoryCalloc(1, sizeof(SWorkThrd));
|
||||
|
|
Loading…
Reference in New Issue