Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
阿啄debugIT
libfastcommon
提交
7d551268
L
libfastcommon
项目概览
阿啄debugIT
/
libfastcommon
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
L
libfastcommon
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
7d551268
编写于
9月 27, 2020
作者:
Y
YuQing
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fixed printf format for port
上级
082a322f
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
33 addition
and
33 deletion
+33
-33
HISTORY
HISTORY
+1
-1
src/connection_pool.c
src/connection_pool.c
+10
-10
src/http_func.c
src/http_func.c
+6
-6
src/multi_socket_client.c
src/multi_socket_client.c
+10
-10
src/server_id_func.c
src/server_id_func.c
+5
-5
src/sockopt.c
src/sockopt.c
+1
-1
未找到文件。
HISTORY
浏览文件 @
7d551268
Version 1.44 2020-09-2
5
Version 1.44 2020-09-2
7
* add test file src/tests/test_pthread_lock.c
* add uniq_skiplist.[hc]
* add function split_string_ex
...
...
src/connection_pool.c
浏览文件 @
7d551268
...
...
@@ -129,7 +129,7 @@ int conn_pool_connect_server_ex(ConnectionInfo *conn,
if
(
log_connect_error
)
{
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__
,
conn
->
ip_addr
,
conn
->
port
,
result
,
STRERROR
(
result
));
}
...
...
@@ -163,7 +163,7 @@ int conn_pool_async_connect_server_ex(ConnectionInfo *conn,
if
(
!
(
result
==
0
||
result
==
EINPROGRESS
))
{
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__
,
conn
->
ip_addr
,
conn
->
port
,
result
,
STRERROR
(
result
));
close
(
conn
->
sock
);
...
...
@@ -229,7 +229,7 @@ ConnectionInfo *conn_pool_get_connection(ConnectionPool *cp,
{
*
err_no
=
ENOSPC
;
logError
(
"file: "
__FILE__
", line: %d, "
\
"connections: %d of server %s:%
d
"
\
"connections: %d of server %s:%
u
"
\
"exceed limit: %d"
,
__LINE__
,
\
cm
->
total_count
,
conn
->
ip_addr
,
\
conn
->
port
,
cp
->
max_count_per_entry
);
...
...
@@ -284,7 +284,7 @@ ConnectionInfo *conn_pool_get_connection(ConnectionPool *cp,
}
logDebug
(
"file: "
__FILE__
", line: %d, "
\
"server %s:%
d
, new connection: %d, "
\
"server %s:%
u
, new connection: %d, "
\
"total_count: %d, free_count: %d"
,
\
__LINE__
,
conn
->
ip_addr
,
conn
->
port
,
\
node
->
conn
->
sock
,
cm
->
total_count
,
\
...
...
@@ -332,7 +332,7 @@ ConnectionInfo *conn_pool_get_connection(ConnectionPool *cp,
cm
->
total_count
--
;
logDebug
(
"file: "
__FILE__
", line: %d, "
\
"server %s:%
d
, connection: %d idle "
\
"server %s:%
u
, connection: %d idle "
\
"time: %d exceeds max idle time: %d, "
\
"total_count: %d, free_count: %d"
,
\
__LINE__
,
conn
->
ip_addr
,
conn
->
port
,
\
...
...
@@ -348,7 +348,7 @@ ConnectionInfo *conn_pool_get_connection(ConnectionPool *cp,
pthread_mutex_unlock
(
&
cm
->
lock
);
logDebug
(
"file: "
__FILE__
", line: %d, "
\
"server %s:%
d
, reuse connection: %d, "
\
"server %s:%
u
, reuse connection: %d, "
\
"total_count: %d, free_count: %d"
,
__LINE__
,
conn
->
ip_addr
,
conn
->
port
,
ci
->
sock
,
cm
->
total_count
,
cm
->
free_count
);
...
...
@@ -374,7 +374,7 @@ int conn_pool_close_connection_ex(ConnectionPool *cp, ConnectionInfo *conn,
if
(
cm
==
NULL
)
{
logError
(
"file: "
__FILE__
", line: %d, "
\
"hash entry of server %s:%
d
not exist"
,
__LINE__
,
\
"hash entry of server %s:%
u
not exist"
,
__LINE__
,
\
conn
->
ip_addr
,
conn
->
port
);
return
ENOENT
;
}
...
...
@@ -383,7 +383,7 @@ int conn_pool_close_connection_ex(ConnectionPool *cp, ConnectionInfo *conn,
if
(
node
->
manager
!=
cm
)
{
logError
(
"file: "
__FILE__
", line: %d, "
\
"manager of server entry %s:%
d
is invalid!"
,
\
"manager of server entry %s:%
u
is invalid!"
,
\
__LINE__
,
conn
->
ip_addr
,
conn
->
port
);
return
EINVAL
;
}
...
...
@@ -394,7 +394,7 @@ int conn_pool_close_connection_ex(ConnectionPool *cp, ConnectionInfo *conn,
cm
->
total_count
--
;
logDebug
(
"file: "
__FILE__
", line: %d, "
"server %s:%
d
, release connection: %d, "
"server %s:%
u
, release connection: %d, "
"total_count: %d, free_count: %d"
,
__LINE__
,
conn
->
ip_addr
,
conn
->
port
,
conn
->
sock
,
cm
->
total_count
,
cm
->
free_count
);
...
...
@@ -417,7 +417,7 @@ int conn_pool_close_connection_ex(ConnectionPool *cp, ConnectionInfo *conn,
cm
->
free_count
++
;
logDebug
(
"file: "
__FILE__
", line: %d, "
\
"server %s:%
d
, free connection: %d, "
\
"server %s:%
u
, free connection: %d, "
\
"total_count: %d, free_count: %d"
,
__LINE__
,
conn
->
ip_addr
,
conn
->
port
,
conn
->
sock
,
cm
->
total_count
,
cm
->
free_count
);
...
...
src/http_func.c
浏览文件 @
7d551268
...
...
@@ -131,7 +131,7 @@ int get_url_content_ex(const char *url, const int url_len,
close
(
sock
);
sprintf
(
error_info
,
"file: "
__FILE__
", line: %d, "
\
"connect to %s:%
d
fail, errno: %d, "
\
"connect to %s:%
u
fail, errno: %d, "
\
"error info: %s"
,
__LINE__
,
domain_name
,
\
port
,
result
,
STRERROR
(
result
));
...
...
@@ -140,7 +140,7 @@ int get_url_content_ex(const char *url, const int url_len,
out_len
=
snprintf
(
out_buff
,
sizeof
(
out_buff
),
\
"GET %s HTTP/1.0
\r\n
"
\
"Host: %s:%
d
\r\n
"
\
"Host: %s:%
u
\r\n
"
\
"Connection: close
\r\n
"
\
"
\r\n
"
,
pURI
,
domain_name
,
port
);
if
((
result
=
tcpsenddata
(
sock
,
out_buff
,
out_len
,
network_timeout
))
!=
0
)
...
...
@@ -148,7 +148,7 @@ int get_url_content_ex(const char *url, const int url_len,
close
(
sock
);
sprintf
(
error_info
,
"file: "
__FILE__
", line: %d, "
\
"send data to %s:%
d
fail, errno: %d, "
\
"send data to %s:%
u
fail, errno: %d, "
\
"error info: %s"
,
__LINE__
,
domain_name
,
\
port
,
result
,
STRERROR
(
result
));
...
...
@@ -206,7 +206,7 @@ int get_url_content_ex(const char *url, const int url_len,
}
else
{
sprintf
(
error_info
,
"file: "
__FILE__
", line: %d, "
\
"recv data from %s:%
d
fail, errno: %d, "
\
"recv data from %s:%
u
fail, errno: %d, "
\
"error info: %s"
,
__LINE__
,
domain_name
,
\
port
,
result
,
STRERROR
(
result
));
...
...
@@ -218,7 +218,7 @@ int get_url_content_ex(const char *url, const int url_len,
if
(
pContent
==
NULL
)
{
sprintf
(
error_info
,
"file: "
__FILE__
", line: %d, "
\
"response data from %s:%
d
is invalid"
,
\
"response data from %s:%
u
is invalid"
,
\
__LINE__
,
domain_name
,
port
);
result
=
EINVAL
;
...
...
@@ -230,7 +230,7 @@ int get_url_content_ex(const char *url, const int url_len,
if
(
pSpace
==
NULL
||
pSpace
>=
pContent
)
{
sprintf
(
error_info
,
"file: "
__FILE__
", line: %d, "
\
"response data from %s:%
d
is invalid"
,
\
"response data from %s:%
u
is invalid"
,
\
__LINE__
,
domain_name
,
port
);
result
=
EINVAL
;
...
...
src/multi_socket_client.c
浏览文件 @
7d551268
...
...
@@ -124,14 +124,14 @@ static int fast_multi_sock_client_do_send(FastMultiSockClient *client,
break
;
}
else
if
(
errno
==
EINTR
)
{
//should retry
logDebug
(
"file: "
__FILE__
", line: %d, "
"server: %s:%
d
, ignore interupt signal"
,
"server: %s:%
u
, ignore interupt signal"
,
__LINE__
,
entry
->
conn
->
ip_addr
,
entry
->
conn
->
port
);
continue
;
}
else
{
result
=
errno
!=
0
?
errno
:
ECONNRESET
;
logError
(
"file: "
__FILE__
", line: %d, "
"send to server %s:%
d
fail, "
"send to server %s:%
u
fail, "
"errno: %d, error info: %s"
,
__LINE__
,
entry
->
conn
->
ip_addr
,
entry
->
conn
->
port
,
...
...
@@ -141,7 +141,7 @@ static int fast_multi_sock_client_do_send(FastMultiSockClient *client,
}
}
else
if
(
bytes
==
0
)
{
logError
(
"file: "
__FILE__
", line: %d, "
"send to server %s:%
d
, sock: %d fail, "
"send to server %s:%
u
, sock: %d fail, "
"connection disconnected"
,
__LINE__
,
entry
->
conn
->
ip_addr
,
entry
->
conn
->
port
,
entry
->
conn
->
sock
);
...
...
@@ -187,7 +187,7 @@ static int fast_multi_sock_client_send_data(FastMultiSockClient *client,
client
->
entries
[
i
].
error_no
=
ENOTCONN
;
client
->
entries
[
i
].
done
=
true
;
logError
(
"file: "
__FILE__
", line: %d, "
"NOT connected to %s:%
d
"
,
"NOT connected to %s:%
u
"
,
__LINE__
,
client
->
entries
[
i
].
conn
->
ip_addr
,
client
->
entries
[
i
].
conn
->
port
);
continue
;
...
...
@@ -239,14 +239,14 @@ static int fast_multi_sock_client_do_recv(FastMultiSockClient *client,
break
;
}
else
if
(
errno
==
EINTR
)
{
//should retry
logDebug
(
"file: "
__FILE__
", line: %d, "
"server: %s:%
d
, ignore interupt signal"
,
"server: %s:%
u
, ignore interupt signal"
,
__LINE__
,
entry
->
conn
->
ip_addr
,
entry
->
conn
->
port
);
continue
;
}
else
{
result
=
errno
!=
0
?
errno
:
ECONNRESET
;
logError
(
"file: "
__FILE__
", line: %d, "
"server: %s:%
d
, recv failed, "
"server: %s:%
u
, recv failed, "
"errno: %d, error info: %s"
,
__LINE__
,
entry
->
conn
->
ip_addr
,
entry
->
conn
->
port
,
...
...
@@ -256,7 +256,7 @@ static int fast_multi_sock_client_do_recv(FastMultiSockClient *client,
}
}
else
if
(
bytes
==
0
)
{
logError
(
"file: "
__FILE__
", line: %d, "
"server: %s:%
d
, sock: %d, recv failed, "
"server: %s:%
u
, sock: %d, recv failed, "
"connection disconnected"
,
__LINE__
,
entry
->
conn
->
ip_addr
,
entry
->
conn
->
port
,
entry
->
conn
->
sock
);
...
...
@@ -274,7 +274,7 @@ static int fast_multi_sock_client_do_recv(FastMultiSockClient *client,
body_length
=
client
->
get_body_length_func
(
&
entry
->
recv_buffer
);
if
(
body_length
<
0
)
{
logError
(
"file: "
__FILE__
", line: %d, "
"server: %s:%
d
, body_length: %d < 0"
,
"server: %s:%
u
, body_length: %d < 0"
,
__LINE__
,
entry
->
conn
->
ip_addr
,
entry
->
conn
->
port
,
body_length
);
result
=
EPIPE
;
...
...
@@ -322,7 +322,7 @@ static int fast_multi_sock_client_deal_io(FastMultiSockClient *client)
if
(
event
&
IOEVENT_ERROR
)
{
logError
(
"file: "
__FILE__
", line: %d, "
"server: %s:%
d
, recv error event: %d, "
"server: %s:%
u
, recv error event: %d, "
"connection reset"
,
__LINE__
,
entry
->
conn
->
ip_addr
,
entry
->
conn
->
port
,
event
);
...
...
@@ -351,7 +351,7 @@ static int fast_multi_sock_client_deal_io(FastMultiSockClient *client)
fast_multi_sock_client_finish
(
client
,
client
->
entries
+
i
,
ETIMEDOUT
);
logError
(
"file: "
__FILE__
", line: %d, "
"recv from %s:%
d
timedout"
,
"recv from %s:%
u
timedout"
,
__LINE__
,
client
->
entries
[
i
].
conn
->
ip_addr
,
client
->
entries
[
i
].
conn
->
port
);
}
...
...
src/server_id_func.c
浏览文件 @
7d551268
...
...
@@ -244,7 +244,7 @@ static int fc_server_check_ip_port(FCServerConfig *ctx,
id2
=
previous
->
server
->
id
;
}
logError
(
"file: "
__FILE__
", line: %d, "
"config file: %s, duplicate ip:port %s:%
d
, "
"config file: %s, duplicate ip:port %s:%
u
, "
"the server ids: %d, %d"
,
__LINE__
,
config_filename
,
previous
->
ip_addr
.
str
,
previous
->
port
,
id1
,
id2
);
...
...
@@ -610,7 +610,7 @@ static int check_addresses_duplicate(FCServerConfig *ctx,
if
(
fc_server_cmp_address_ptr
(
ppaddr
,
pprevious
)
==
0
)
{
logError
(
"file: "
__FILE__
", line: %d, "
"config filename: %s, section: %s, group: %.*s, "
"duplicate ip and port: %s:%
d
"
,
__LINE__
,
"duplicate ip and port: %s:%
u
"
,
__LINE__
,
config_filename
,
section_name
,
group_addr
->
server_group
->
group_name
.
len
,
group_addr
->
server_group
->
group_name
.
str
,
...
...
@@ -853,7 +853,7 @@ static int fc_server_set_host(FCServerConfig *ctx, FCServerInfo *server,
if
(
!
ctx
->
share_between_groups
&&
(
count
>
1
&&
addr
->
conn
.
port
>
0
))
{
logError
(
"file: "
__FILE__
", line: %d, "
"config filename: %s, section: %s, "
"host %s:%
d
belongs to %d groups"
,
"host %s:%
u
belongs to %d groups"
,
__LINE__
,
config_filename
,
section_name
,
addr
->
conn
.
ip_addr
,
addr
->
conn
.
port
,
count
);
return
EEXIST
;
...
...
@@ -1324,7 +1324,7 @@ static void fc_group_servers_to_string(FCServerConfig *ctx,
gaddr
->
server_group
->
group_name
.
str
,
SERVER_ITEM_HOST_AFFIX_STR
);
}
fast_buffer_append
(
buffer
,
" = %s:%
d
\n
"
,
fast_buffer_append
(
buffer
,
" = %s:%
u
\n
"
,
(
*
addr
)
->
conn
.
ip_addr
,
(
*
addr
)
->
conn
.
port
);
}
}
...
...
@@ -1407,7 +1407,7 @@ static void fc_server_log_group_servers(FCGroupAddresses *gaddr)
end
=
gaddr
->
address_array
.
addrs
+
gaddr
->
address_array
.
count
;
for
(
addr
=
gaddr
->
address_array
.
addrs
;
addr
<
end
;
addr
++
)
{
logInfo
(
" %d. %s:%
d
"
,
(
int
)(
addr
-
gaddr
->
address_array
.
addrs
+
1
),
logInfo
(
" %d. %s:%
u
"
,
(
int
)(
addr
-
gaddr
->
address_array
.
addrs
+
1
),
(
*
addr
)
->
conn
.
ip_addr
,
(
*
addr
)
->
conn
.
port
);
}
}
...
...
src/sockopt.c
浏览文件 @
7d551268
...
...
@@ -720,7 +720,7 @@ int socketClientEx2(int af, const char *server_ip,
if
(
*
err_no
!=
0
)
{
logError
(
"file: "
__FILE__
", line: %d, "
"connect to %s:%
d
fail, "
"connect to %s:%
u
fail, "
"errno: %d, error info: %s"
,
__LINE__
,
server_ip
,
server_port
,
*
err_no
,
STRERROR
(
*
err_no
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录