修改promis_fail错误描述
This commit is contained in:
50
cache/cache_evbase_client.cpp
vendored
50
cache/cache_evbase_client.cpp
vendored
@@ -115,13 +115,13 @@ static int32_t iothread_notify_event(int32_t socket_fd, void *content, int32_t l
|
||||
}
|
||||
if(res <= 0)
|
||||
{
|
||||
printf("log_error: select io res=%d, error: %s", res, strerror(errno));
|
||||
printf("log_error: select io res=%d, error: %s\n", res, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(FD_ISSET(socket_fd, &e_set))
|
||||
{
|
||||
printf("log_error: select io is in efds, error: %s", strerror(errno));
|
||||
printf("log_error: select io is in efds, error: %s\n", strerror(errno));
|
||||
return -2;
|
||||
}
|
||||
|
||||
@@ -250,15 +250,11 @@ void cache_evbase_update_end(struct cache_evbase_ctx *ctx_asyn)
|
||||
buffer->ctx_asyn = ctx_asyn;
|
||||
buffer->cmd_type = CACHE_ASYN_UPLOAD_END;
|
||||
|
||||
if(iothread_notify_event(ctx_asyn->instance_asyn->notify_sendfd, &buffer, sizeof(void *), 0) != sizeof(void *))
|
||||
if(iothread_notify_event(ctx_asyn->instance_asyn->notify_sendfd, &buffer, sizeof(void *), 2) != sizeof(void *))
|
||||
{
|
||||
if(!ctx_asyn->ctx->fail_state)
|
||||
{
|
||||
ctx_asyn->ctx->fail_state = true;
|
||||
if(ctx_asyn->ctx->future != NULL)
|
||||
{
|
||||
promise_failed(future_to_promise(ctx_asyn->ctx->future), FUTURE_ERROR_CANCEL, "write sockpair error");
|
||||
}
|
||||
tango_cache_set_fail_state(ctx_asyn->ctx, CACHE_ERR_SOCKPAIR);
|
||||
}
|
||||
tango_cache_ctx_destroy(ctx_asyn->ctx);
|
||||
cache_asyn_ctx_destroy(ctx_asyn);
|
||||
@@ -289,12 +285,11 @@ int cache_evbase_update_frag_data(struct cache_evbase_ctx *ctx_asyn, enum PUT_ME
|
||||
buffer->ctx_asyn = ctx_asyn;
|
||||
buffer->cmd_type = CACHE_ASYN_UPLOAD_FRAG_DATA;
|
||||
|
||||
if(iothread_notify_event(ctx_asyn->instance_asyn->notify_sendfd, &buffer, sizeof(void *), 0) != sizeof(void *))
|
||||
if(iothread_notify_event(ctx_asyn->instance_asyn->notify_sendfd, &buffer, sizeof(void *), 2) != sizeof(void *))
|
||||
{
|
||||
ctx_asyn->ctx->fail_state = true;
|
||||
if(ctx_asyn->ctx->future != NULL)
|
||||
if(!ctx_asyn->ctx->fail_state)
|
||||
{
|
||||
promise_failed(future_to_promise(ctx_asyn->ctx->future), FUTURE_ERROR_CANCEL, "write sockpair error");
|
||||
tango_cache_set_fail_state(ctx_asyn->ctx, CACHE_ERR_SOCKPAIR);
|
||||
}
|
||||
free(buffer->data);
|
||||
free(buffer);
|
||||
@@ -317,12 +312,11 @@ int cache_evbase_update_frag_evbuf(struct cache_evbase_ctx *ctx_asyn, struct evb
|
||||
buffer->evbuf = evbuffer_new();
|
||||
evbuffer_add_buffer(buffer->evbuf, evbuf);
|
||||
|
||||
if(iothread_notify_event(ctx_asyn->instance_asyn->notify_sendfd, &buffer, sizeof(void *), 0) != sizeof(void *))
|
||||
if(iothread_notify_event(ctx_asyn->instance_asyn->notify_sendfd, &buffer, sizeof(void *), 2) != sizeof(void *))
|
||||
{
|
||||
ctx_asyn->ctx->fail_state = true;
|
||||
if(ctx_asyn->ctx->future != NULL)
|
||||
if(!ctx_asyn->ctx->fail_state)
|
||||
{
|
||||
promise_failed(future_to_promise(ctx_asyn->ctx->future), FUTURE_ERROR_CANCEL, "write sockpair error");
|
||||
tango_cache_set_fail_state(ctx_asyn->ctx, CACHE_ERR_SOCKPAIR);
|
||||
}
|
||||
evbuffer_free(buffer->evbuf);
|
||||
free(buffer);
|
||||
@@ -352,9 +346,9 @@ struct cache_evbase_ctx *cache_evbase_update_start(struct cache_evbase_instance
|
||||
buffer->cmd_type = CACHE_ASYN_UPLOAD_START;
|
||||
|
||||
//<2F>¼<EFBFBD>֪ͨ<CDA8><D6AA>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͳ<EFBFBD><CDB3><EFBFBD><EFBFBD>Ϣ
|
||||
if(iothread_notify_event(instance->notify_sendfd, &buffer, sizeof(void *), 0) != sizeof(void *))
|
||||
if(iothread_notify_event(instance->notify_sendfd, &buffer, sizeof(void *), 2) != sizeof(void *))
|
||||
{
|
||||
ctx_asyn->ctx->fail_state = true;
|
||||
tango_cache_set_fail_state(ctx_asyn->ctx, CACHE_ERR_SOCKPAIR);
|
||||
tango_cache_ctx_destroy(ctx_asyn->ctx);
|
||||
cache_asyn_ctx_destroy(ctx_asyn);
|
||||
free(buffer);
|
||||
@@ -398,11 +392,11 @@ int cache_evbase_upload_once_data(struct cache_evbase_instance *instance, struct
|
||||
buffer->ctx_asyn = ctx_asyn;
|
||||
buffer->cmd_type = CACHE_ASYN_UPLOAD_ONCE_DATA;
|
||||
|
||||
if(iothread_notify_event(instance->notify_sendfd, &buffer, sizeof(void *), 0) != sizeof(void *))
|
||||
if(iothread_notify_event(instance->notify_sendfd, &buffer, sizeof(void *), 2) != sizeof(void *))
|
||||
{
|
||||
free(buffer->data);
|
||||
free(buffer);
|
||||
ctx_asyn->ctx->fail_state = true;
|
||||
tango_cache_set_fail_state(ctx_asyn->ctx, CACHE_ERR_SOCKPAIR);
|
||||
tango_cache_ctx_destroy(ctx);
|
||||
cache_asyn_ctx_destroy(ctx_asyn);
|
||||
return -2;
|
||||
@@ -437,11 +431,11 @@ int cache_evbase_upload_once_evbuf(struct cache_evbase_instance *instance, struc
|
||||
buffer->evbuf = evbuffer_new();
|
||||
evbuffer_add_buffer(buffer->evbuf, evbuf);
|
||||
|
||||
if(iothread_notify_event(instance->notify_sendfd, &buffer, sizeof(void *), 0) != sizeof(void *))
|
||||
if(iothread_notify_event(instance->notify_sendfd, &buffer, sizeof(void *), 2) != sizeof(void *))
|
||||
{
|
||||
evbuffer_free(buffer->evbuf);
|
||||
free(buffer);
|
||||
ctx_asyn->ctx->fail_state = true;
|
||||
tango_cache_set_fail_state(ctx_asyn->ctx, CACHE_ERR_SOCKPAIR);
|
||||
tango_cache_ctx_destroy(ctx);
|
||||
cache_asyn_ctx_destroy(ctx_asyn);
|
||||
return -2;
|
||||
@@ -467,8 +461,10 @@ int cache_evbase_fetch_object(struct cache_evbase_instance *instance, struct fut
|
||||
buffer->ctx_asyn = ctx_asyn;
|
||||
buffer->cmd_type = CACHE_ASYN_FETCH;
|
||||
|
||||
if(iothread_notify_event(instance->notify_sendfd, &buffer, sizeof(void *), 0) != sizeof(void *))
|
||||
if(iothread_notify_event(instance->notify_sendfd, &buffer, sizeof(void *), 2) != sizeof(void *))
|
||||
{
|
||||
tango_cache_set_fail_state(ctx_asyn->ctx, CACHE_ERR_SOCKPAIR);
|
||||
promise_failed(future_to_promise(future), FUTURE_ERROR_CANCEL, tango_cache_get_errstring(ctx_asyn->ctx));
|
||||
tango_cache_ctx_destroy(ctx_asyn->ctx);
|
||||
cache_asyn_ctx_destroy(ctx_asyn);
|
||||
free(buffer);
|
||||
@@ -496,9 +492,13 @@ int cache_evbase_delete_object(struct cache_evbase_instance *instance, struct fu
|
||||
buffer->cmd_type = CACHE_ASYN_DELETE;
|
||||
|
||||
//<2F>ο<EFBFBD>Unix<69><EFBFBD><DFBC><EFBFBD><EFBFBD><EFBFBD>432ҳ<32><D2B3><EFBFBD>ڶ<EFBFBD><DAB6>߳<EFBFBD>д<EFBFBD>İ<EFBFBD>ȫ<EFBFBD><C8AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
if(iothread_notify_event(instance->notify_sendfd, &buffer, sizeof(void *), 0) != sizeof(void *))
|
||||
if(iothread_notify_event(instance->notify_sendfd, &buffer, sizeof(void *), 2) != sizeof(void *))
|
||||
{
|
||||
ctx_asyn->ctx->fail_state = true;
|
||||
tango_cache_set_fail_state(ctx_asyn->ctx, CACHE_ERR_SOCKPAIR);
|
||||
if(future != NULL)
|
||||
{
|
||||
promise_failed(future_to_promise(future), FUTURE_ERROR_CANCEL, tango_cache_get_errstring(ctx_asyn->ctx));
|
||||
}
|
||||
tango_cache_ctx_destroy(ctx_asyn->ctx);
|
||||
cache_asyn_ctx_destroy(ctx_asyn);
|
||||
free(buffer);
|
||||
|
||||
Reference in New Issue
Block a user