Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
e7a72d5a
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
e7a72d5a
编写于
2月 03, 2023
作者:
dengyihao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: no resp when host machine shutdown
上级
b1192d50
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
32 addition
and
9 deletion
+32
-9
source/libs/transport/src/transCli.c
source/libs/transport/src/transCli.c
+24
-5
source/libs/transport/src/transComm.c
source/libs/transport/src/transComm.c
+4
-0
source/os/src/osSocket.c
source/os/src/osSocket.c
+4
-4
未找到文件。
source/libs/transport/src/transCli.c
浏览文件 @
e7a72d5a
...
...
@@ -671,7 +671,7 @@ static SCliConn* cliCreateConn(SCliThrd* pThrd) {
conn
->
stream
=
(
uv_stream_t
*
)
taosMemoryMalloc
(
sizeof
(
uv_tcp_t
));
uv_tcp_init
(
pThrd
->
loop
,
(
uv_tcp_t
*
)(
conn
->
stream
));
conn
->
stream
->
data
=
conn
;
transSetConnOption
((
uv_tcp_t
*
)
conn
->
stream
);
//
transSetConnOption((uv_tcp_t*)conn->stream);
uv_timer_t
*
timer
=
taosArrayGetSize
(
pThrd
->
timerList
)
>
0
?
*
(
uv_timer_t
**
)
taosArrayPop
(
pThrd
->
timerList
)
:
NULL
;
if
(
timer
==
NULL
)
{
...
...
@@ -1061,9 +1061,10 @@ void cliHandleReq(SCliMsg* pMsg, SCliThrd* pThrd) {
STransConnCtx
*
pCtx
=
pMsg
->
ctx
;
cliMayCvtFqdnToIp
(
&
pCtx
->
epSet
,
&
pThrd
->
cvtAddr
);
STraceId
*
trace
=
&
pMsg
->
msg
.
info
.
traceId
;
if
(
!
EPSET_IS_VALID
(
&
pCtx
->
epSet
))
{
t
Error
(
"invalid epset"
);
t
GError
(
"%s, msg %s sent with invalid epset"
,
pTransInst
->
label
,
TMSG_INFO
(
pMsg
->
msg
.
msgType
)
);
destroyCmsg
(
pMsg
);
return
;
}
...
...
@@ -1121,10 +1122,29 @@ void cliHandleReq(SCliMsg* pMsg, SCliThrd* pThrd) {
addr
.
sin_addr
.
s_addr
=
cliGetIpFromFqdnCache
(
pThrd
->
fqdn2ipCache
,
conn
->
ip
);
addr
.
sin_port
=
(
uint16_t
)
htons
((
uint16_t
)
conn
->
port
);
STraceId
*
trace
=
&
(
pMsg
->
msg
.
info
.
traceId
);
tGTrace
(
"%s conn %p try to connect to %s:%d"
,
pTransInst
->
label
,
conn
,
conn
->
ip
,
conn
->
port
);
int32_t
fd
=
taosCreateSocketWithTimeout
(
TRANS_CONN_TIMEOUT
*
4
);
if
(
fd
==
-
1
)
{
tGError
(
"%s conn %p failed to create socket, reason:%s"
,
transLabel
(
pTransInst
),
conn
,
tstrerror
(
TAOS_SYSTEM_ERROR
(
errno
)));
cliHandleExcept
(
conn
);
errno
=
0
;
return
;
}
int
ret
=
uv_tcp_open
((
uv_tcp_t
*
)
conn
->
stream
,
fd
);
if
(
ret
!=
0
)
{
tGError
(
"%s conn %p failed to set stream, reason:%s"
,
transLabel
(
pTransInst
),
conn
,
uv_err_name
(
ret
));
cliHandleExcept
(
conn
);
return
;
}
ret
=
transSetConnOption
((
uv_tcp_t
*
)
conn
->
stream
);
if
(
ret
!=
0
)
{
tGError
(
"%s conn %p failed to set socket opt, reason:%s"
,
transLabel
(
pTransInst
),
conn
,
uv_err_name
(
ret
));
cliHandleExcept
(
conn
);
return
;
}
int
ret
=
uv_tcp_connect
(
&
conn
->
connReq
,
(
uv_tcp_t
*
)(
conn
->
stream
),
(
const
struct
sockaddr
*
)
&
addr
,
cliConnCb
);
ret
=
uv_tcp_connect
(
&
conn
->
connReq
,
(
uv_tcp_t
*
)(
conn
->
stream
),
(
const
struct
sockaddr
*
)
&
addr
,
cliConnCb
);
if
(
ret
!=
0
)
{
tGError
(
"%s conn %p failed to connect to %s:%d, reason:%s"
,
pTransInst
->
label
,
conn
,
conn
->
ip
,
conn
->
port
,
uv_err_name
(
ret
));
...
...
@@ -1139,7 +1159,6 @@ void cliHandleReq(SCliMsg* pMsg, SCliThrd* pThrd) {
}
uv_timer_start
(
conn
->
timer
,
cliConnTimeout
,
TRANS_CONN_TIMEOUT
,
0
);
}
STraceId
*
trace
=
&
pMsg
->
msg
.
info
.
traceId
;
tGTrace
(
"%s conn %p ready"
,
pTransInst
->
label
,
conn
);
}
static
void
cliAsyncCb
(
uv_async_t
*
handle
)
{
...
...
source/libs/transport/src/transComm.c
浏览文件 @
e7a72d5a
...
...
@@ -205,6 +205,10 @@ bool transReadComplete(SConnBuffer* connBuf) {
}
int
transSetConnOption
(
uv_tcp_t
*
stream
)
{
#if defined(WINDOWS) || defined(DARWIN)
#else
uv_tcp_keepalive
(
stream
,
1
,
20
);
#endif
return
uv_tcp_nodelay
(
stream
,
1
);
// int ret = uv_tcp_keepalive(stream, 5, 60);
}
...
...
source/os/src/osSocket.c
浏览文件 @
e7a72d5a
...
...
@@ -55,7 +55,7 @@ typedef struct TdSocket {
#endif
int
refId
;
SocketFd
fd
;
}
*
TdSocketPtr
,
TdSocket
;
}
*
TdSocketPtr
,
TdSocket
;
typedef
struct
TdSocketServer
{
#if SOCKET_WITH_LOCK
...
...
@@ -63,7 +63,7 @@ typedef struct TdSocketServer {
#endif
int
refId
;
SocketFd
fd
;
}
*
TdSocketServerPtr
,
TdSocketServer
;
}
*
TdSocketServerPtr
,
TdSocketServer
;
typedef
struct
TdEpoll
{
#if SOCKET_WITH_LOCK
...
...
@@ -71,7 +71,7 @@ typedef struct TdEpoll {
#endif
int
refId
;
EpollFd
fd
;
}
*
TdEpollPtr
,
TdEpoll
;
}
*
TdEpollPtr
,
TdEpoll
;
#if 0
int32_t taosSendto(TdSocketPtr pSocket, void *buf, int len, unsigned int flags, const struct sockaddr *dest_addr,
...
...
@@ -1005,7 +1005,7 @@ int32_t taosGetFqdn(char *fqdn) {
// immediately
// hints.ai_family = AF_INET;
strcpy
(
fqdn
,
hostname
);
strcpy
(
fqdn
+
strlen
(
hostname
),
".local"
);
strcpy
(
fqdn
+
strlen
(
hostname
),
".local"
);
#else // __APPLE__
struct
addrinfo
hints
=
{
0
};
struct
addrinfo
*
result
=
NULL
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录