fixed printf format for port
parent
a2b33ecfd8
commit
6cecfaa949
|
|
@ -156,7 +156,7 @@ void client_channel_destroy()
|
|||
}
|
||||
|
||||
struct fast_task_info *alloc_channel_task(IdempotencyClientChannel *channel,
|
||||
const uint32_t hash_code, const char *server_ip, const short port,
|
||||
const uint32_t hash_code, const char *server_ip, const uint16_t port,
|
||||
int *err_no)
|
||||
{
|
||||
struct fast_task_info *task;
|
||||
|
|
@ -204,7 +204,7 @@ int idempotency_client_channel_check_reconnect(
|
|||
}
|
||||
|
||||
logDebug("file: "__FILE__", line: %d, "
|
||||
"trigger connect to server %s:%d",
|
||||
"trigger connect to server %s:%u",
|
||||
__LINE__, channel->task->server_ip,
|
||||
channel->task->port);
|
||||
|
||||
|
|
@ -219,7 +219,7 @@ int idempotency_client_channel_check_reconnect(
|
|||
}
|
||||
|
||||
struct idempotency_client_channel *idempotency_client_channel_get(
|
||||
const char *server_ip, const short server_port,
|
||||
const char *server_ip, const uint16_t server_port,
|
||||
const int timeout, int *err_no)
|
||||
{
|
||||
int r;
|
||||
|
|
@ -232,7 +232,7 @@ struct idempotency_client_channel *idempotency_client_channel_get(
|
|||
IdempotencyClientChannel *current;
|
||||
IdempotencyClientChannel *channel;
|
||||
|
||||
key_len = snprintf(key, sizeof(key), "%s_%d", server_ip, server_port);
|
||||
key_len = snprintf(key, sizeof(key), "%s_%u", server_ip, server_port);
|
||||
hash_code = simple_hash(key, key_len);
|
||||
bucket = channel_context.htable.buckets +
|
||||
hash_code % channel_context.htable.capacity;
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ void idempotency_client_channel_config_to_string_ex(
|
|||
char *output, const int size, const bool add_comma);
|
||||
|
||||
struct idempotency_client_channel *idempotency_client_channel_get(
|
||||
const char *server_ip, const short server_port,
|
||||
const char *server_ip, const uint16_t server_port,
|
||||
const int timeout, int *err_no);
|
||||
|
||||
static inline uint64_t idempotency_client_channel_next_seq_id(
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ static int receipt_recv_timeout_callback(struct fast_task_info *task)
|
|||
|
||||
if (SF_NIO_TASK_STAGE_FETCH(task) == SF_NIO_STAGE_CONNECT) {
|
||||
logError("file: "__FILE__", line: %d, "
|
||||
"connect to server %s:%d timeout",
|
||||
"connect to server %s:%u timeout",
|
||||
__LINE__, task->server_ip, task->port);
|
||||
return ETIMEDOUT;
|
||||
}
|
||||
|
|
@ -49,11 +49,11 @@ static int receipt_recv_timeout_callback(struct fast_task_info *task)
|
|||
channel = (IdempotencyClientChannel *)task->arg;
|
||||
if (channel->waiting_resp_qinfo.head != NULL) {
|
||||
logError("file: "__FILE__", line: %d, "
|
||||
"waiting receipt response from server %s:%d timeout",
|
||||
"waiting receipt response from server %s:%u timeout",
|
||||
__LINE__, task->server_ip, task->port);
|
||||
} else {
|
||||
logError("file: "__FILE__", line: %d, "
|
||||
"communication with server %s:%d timeout",
|
||||
"communication with server %s:%u timeout",
|
||||
__LINE__, task->server_ip, task->port);
|
||||
}
|
||||
|
||||
|
|
@ -77,7 +77,7 @@ static void receipt_task_finish_cleanup(struct fast_task_info *task)
|
|||
__sync_bool_compare_and_swap(&channel->in_ioevent, 1, 0);
|
||||
|
||||
logDebug("file: "__FILE__", line: %d, "
|
||||
"receipt task for server %s:%d exit",
|
||||
"receipt task for server %s:%u exit",
|
||||
__LINE__, task->server_ip, task->port);
|
||||
}
|
||||
|
||||
|
|
@ -216,7 +216,7 @@ static inline int receipt_expect_body_length(struct fast_task_info *task,
|
|||
{
|
||||
if ((int)(task->length - sizeof(SFCommonProtoHeader)) != expect_body_len) {
|
||||
logError("file: "__FILE__", line: %d, "
|
||||
"server %s:%d, response body length: %d != %d",
|
||||
"server %s:%u, response body length: %d != %d",
|
||||
__LINE__, task->server_ip, task->port, (int)(task->length -
|
||||
sizeof(SFCommonProtoHeader)), expect_body_len);
|
||||
return EINVAL;
|
||||
|
|
@ -244,7 +244,7 @@ static int deal_setup_channel_response(struct fast_task_info *task)
|
|||
channel = (IdempotencyClientChannel *)task->arg;
|
||||
if (__sync_add_and_fetch(&channel->established, 0)) {
|
||||
logWarning("file: "__FILE__", line: %d, "
|
||||
"response from server %s:%d, unexpected cmd: "
|
||||
"response from server %s:%u, unexpected cmd: "
|
||||
"SETUP_CHANNEL_RESP, ignore it!",
|
||||
__LINE__, task->server_ip, task->port);
|
||||
return 0;
|
||||
|
|
@ -290,7 +290,7 @@ static inline int deal_report_req_receipt_response(struct fast_task_info *task)
|
|||
channel = (IdempotencyClientChannel *)task->arg;
|
||||
if (channel->waiting_resp_qinfo.head == NULL) {
|
||||
logWarning("file: "__FILE__", line: %d, "
|
||||
"response from server %s:%d, unexpect cmd: "
|
||||
"response from server %s:%u, unexpect cmd: "
|
||||
"REPORT_REQ_RECEIPT_RESP", __LINE__,
|
||||
task->server_ip, task->port);
|
||||
return 0;
|
||||
|
|
@ -338,7 +338,7 @@ static int receipt_deal_task(struct fast_task_info *task)
|
|||
msg_len = task->length - sizeof(SFCommonProtoHeader);
|
||||
message = task->data + sizeof(SFCommonProtoHeader);
|
||||
logError("file: "__FILE__", line: %d, "
|
||||
"response from server %s:%d, cmd: %d (%s), "
|
||||
"response from server %s:%u, cmd: %d (%s), "
|
||||
"status: %d, error info: %.*s",
|
||||
__LINE__, task->server_ip, task->port,
|
||||
((SFCommonProtoHeader *)task->data)->cmd,
|
||||
|
|
@ -360,12 +360,12 @@ static int receipt_deal_task(struct fast_task_info *task)
|
|||
case SF_SERVICE_PROTO_CLOSE_CHANNEL_RESP:
|
||||
result = ECONNRESET; //force to close socket
|
||||
logDebug("file: "__FILE__", line: %d, "
|
||||
"close channel to server %s:%d !!!",
|
||||
"close channel to server %s:%u !!!",
|
||||
__LINE__, task->server_ip, task->port);
|
||||
break;
|
||||
default:
|
||||
logError("file: "__FILE__", line: %d, "
|
||||
"response from server %s:%d, unexpect cmd: %d (%s)",
|
||||
"response from server %s:%u, unexpect cmd: %d (%s)",
|
||||
__LINE__, task->server_ip, task->port,
|
||||
((SFCommonProtoHeader *)task->data)->cmd,
|
||||
sf_get_cmd_caption(((SFCommonProtoHeader *)task->data)->cmd));
|
||||
|
|
@ -418,7 +418,7 @@ static void receipt_thread_close_idle_channel(
|
|||
g_idempotency_client_cfg.channel_max_idle_time)
|
||||
{
|
||||
logDebug("file: "__FILE__", line: %d, "
|
||||
"close channel to server %s:%d because idle too long",
|
||||
"close channel to server %s:%u because idle too long",
|
||||
__LINE__, channel->task->server_ip, channel->task->port);
|
||||
close_channel_request(channel->task);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -380,13 +380,13 @@ void sf_context_config_to_string(const SFContext *sf_context,
|
|||
sf_context->outer_bind_addr) == 0))
|
||||
{
|
||||
len += snprintf(output + len, size - len,
|
||||
"port=%d, bind_addr=%s",
|
||||
"port=%u, bind_addr=%s",
|
||||
sf_context->inner_port,
|
||||
sf_context->inner_bind_addr);
|
||||
} else {
|
||||
len += snprintf(output + len, size - len,
|
||||
"inner_port=%d, inner_bind_addr=%s, "
|
||||
"outer_port=%d, outer_bind_addr=%s",
|
||||
"inner_port=%u, inner_bind_addr=%s, "
|
||||
"outer_port=%u, outer_bind_addr=%s",
|
||||
sf_context->inner_port, sf_context->inner_bind_addr,
|
||||
sf_context->outer_port, sf_context->outer_bind_addr);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -177,7 +177,7 @@ static int sf_client_sock_connect(int sock, short event, void *arg)
|
|||
|
||||
if (result != 0) {
|
||||
logError("file: "__FILE__", line: %d, "
|
||||
"connect to server %s:%d fail, errno: %d, "
|
||||
"connect to server %s:%u fail, errno: %d, "
|
||||
"error info: %s", __LINE__, task->server_ip,
|
||||
task->port, result, STRERROR(result));
|
||||
iovent_add_to_deleted_list(task);
|
||||
|
|
@ -185,7 +185,7 @@ static int sf_client_sock_connect(int sock, short event, void *arg)
|
|||
}
|
||||
|
||||
logInfo("file: "__FILE__", line: %d, "
|
||||
"connect to server %s:%d successfully",
|
||||
"connect to server %s:%u successfully",
|
||||
__LINE__, task->server_ip, task->port);
|
||||
sf_nio_set_stage(task, SF_NIO_STAGE_HANDSHAKE);
|
||||
return SF_CTX->deal_task(task);
|
||||
|
|
@ -211,7 +211,7 @@ static int sf_connect_server(struct fast_task_info *task)
|
|||
}
|
||||
|
||||
logInfo("file: "__FILE__", line: %d, "
|
||||
"connect to server %s:%d successfully",
|
||||
"connect to server %s:%u successfully",
|
||||
__LINE__, task->server_ip, task->port);
|
||||
sf_nio_set_stage(task, SF_NIO_STAGE_HANDSHAKE);
|
||||
return SF_CTX->deal_task(task);
|
||||
|
|
@ -224,7 +224,7 @@ static int sf_connect_server(struct fast_task_info *task)
|
|||
close(task->event.fd);
|
||||
task->event.fd = -1;
|
||||
logError("file: "__FILE__", line: %d, "
|
||||
"connect to server %s:%d fail, errno: %d, "
|
||||
"connect to server %s:%u fail, errno: %d, "
|
||||
"error info: %s", __LINE__, task->server_ip,
|
||||
task->port, result, STRERROR(result));
|
||||
return result > 0 ? -1 * result : result;
|
||||
|
|
|
|||
|
|
@ -105,13 +105,13 @@ static inline void sf_log_network_error_ex1(SFResponseInfo *response,
|
|||
if (response->error.length > 0) {
|
||||
log_it_ex(&g_log_context, log_level,
|
||||
"file: %s, line: %d, "
|
||||
"server %s:%d, %s", file, line,
|
||||
"server %s:%u, %s", file, line,
|
||||
conn->ip_addr, conn->port,
|
||||
response->error.message);
|
||||
} else {
|
||||
log_it_ex(&g_log_context, log_level,
|
||||
"file: %s, line: %d, "
|
||||
"communicate with server %s:%d fail, "
|
||||
"communicate with server %s:%u fail, "
|
||||
"errno: %d, error info: %s", file, line,
|
||||
conn->ip_addr, conn->port,
|
||||
result, STRERROR(result));
|
||||
|
|
|
|||
Loading…
Reference in New Issue