Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
afb33efc
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看板
提交
afb33efc
编写于
11月 04, 2019
作者:
H
hjxilinx
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
configure the connection option through taos_options #671
上级
5d1b1735
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
28 addition
and
9 deletion
+28
-9
packaging/cfg/taos.cfg
packaging/cfg/taos.cfg
+3
-2
src/client/src/tscSystem.c
src/client/src/tscSystem.c
+15
-0
src/inc/taos.h
src/inc/taos.h
+1
-0
src/inc/tglobalcfg.h
src/inc/tglobalcfg.h
+1
-1
src/inc/trpc.h
src/inc/trpc.h
+5
-2
src/util/src/tglobalcfg.c
src/util/src/tglobalcfg.c
+3
-4
未找到文件。
packaging/cfg/taos.cfg
浏览文件 @
afb33efc
...
...
@@ -54,8 +54,9 @@
# interval of system monitor
# monitorInterval 60
# set socket type(UDP by default). if udpsocket is 0, TCP is applied for all connections
# udpsocket 1
# set socket type("udp" and "tcp").
# The server and client should have the same socket type. Otherwise, connect will fail.
# sockettype udp
# RPC re-try timer, millisecond
# rpcTimer 300
...
...
src/client/src/tscSystem.c
浏览文件 @
afb33efc
...
...
@@ -174,6 +174,7 @@ int taos_options(TSDB_OPTION option, const void *arg, ...) {
SGlobalConfig
*
cfg_locale
=
tsGetConfigOption
(
"locale"
);
SGlobalConfig
*
cfg_charset
=
tsGetConfigOption
(
"charset"
);
SGlobalConfig
*
cfg_timezone
=
tsGetConfigOption
(
"timezone"
);
SGlobalConfig
*
cfg_socket
=
tsGetConfigOption
(
"sockettype"
);
switch
(
option
)
{
case
TSDB_OPTION_CONFIGDIR
:
...
...
@@ -304,6 +305,20 @@ int taos_options(TSDB_OPTION option, const void *arg, ...) {
tsCfgStatusStr
[
cfg_timezone
->
cfgStatus
],
(
char
*
)
cfg_timezone
->
ptr
);
}
break
;
case
TSDB_OPTION_SOCKET_TYPE
:
if
(
cfg_socket
&&
cfg_socket
->
cfgStatus
<=
TSDB_CFG_CSTATUS_OPTION
)
{
if
(
strcasecmp
(
arg
,
TAOS_SOCKET_TYPE_NAME_UDP
)
!=
0
&&
strcasecmp
(
arg
,
TAOS_SOCKET_TYPE_NAME_TCP
)
!=
0
)
{
tscError
(
"only 'tcp' or 'udp' allowed for configuring the socket type"
);
return
-
1
;
}
strncpy
(
tsSocketType
,
arg
,
tListLen
(
tsSocketType
));
cfg_socket
->
cfgStatus
=
TSDB_CFG_CSTATUS_OPTION
;
tscPrint
(
"socket type is set:%s"
,
tsSocketType
);
}
break
;
default:
tscError
(
"Invalid option %d"
,
option
);
return
-
1
;
...
...
src/inc/taos.h
浏览文件 @
afb33efc
...
...
@@ -46,6 +46,7 @@ typedef enum {
TSDB_OPTION_TIMEZONE
,
TSDB_OPTION_CONFIGDIR
,
TSDB_OPTION_SHELL_ACTIVITY_TIMER
,
TSDB_OPTION_SOCKET_TYPE
,
TSDB_MAX_OPTIONS
}
TSDB_OPTION
;
...
...
src/inc/tglobalcfg.h
浏览文件 @
afb33efc
...
...
@@ -132,7 +132,7 @@ extern int tsStreamCompRetryDelay;
extern
int
tsProjectExecInterval
;
extern
int64_t
tsMaxRetentWindow
;
extern
int
tsUDPSocket
;
extern
char
tsSocketType
[
4
]
;
extern
char
tsHttpIp
[];
extern
short
tsHttpPort
;
...
...
src/inc/trpc.h
浏览文件 @
afb33efc
...
...
@@ -30,12 +30,15 @@ extern "C" {
#define TAOS_CONN_HTTPS 4
#define TAOS_CONN_HTTPC 5
#define TAOS_SOCKET_TYPE_NAME_TCP "tcp"
#define TAOS_SOCKET_TYPE_NAME_UDP "udp"
#define TAOS_ID_ASSIGNED 0
#define TAOS_ID_FREE 1
#define TAOS_ID_REALLOCATE 2
#define TAOS_CONN_SOCKET_TYPE_S() ((
tsUDPSocket == 1
)? TAOS_CONN_UDPS:TAOS_CONN_TCPS)
#define TAOS_CONN_SOCKET_TYPE_C() ((
tsUDPSocket == 1
)? TAOS_CONN_UDP:TAOS_CONN_TCPC)
#define TAOS_CONN_SOCKET_TYPE_S() ((
strcasecmp(tsSocketType, TAOS_SOCKET_TYPE_NAME_UDP) == 0
)? TAOS_CONN_UDPS:TAOS_CONN_TCPS)
#define TAOS_CONN_SOCKET_TYPE_C() ((
strcasecmp(tsSocketType, TAOS_SOCKET_TYPE_NAME_UDP) == 0
)? TAOS_CONN_UDP:TAOS_CONN_TCPC)
#define taosSendMsgToPeer(x, y, z) taosSendMsgToPeerH(x, y, z, NULL)
#define taosOpenRpcChann(x, y, z) taosOpenRpcChannWithQ(x, y, z, NULL)
...
...
src/util/src/tglobalcfg.c
浏览文件 @
afb33efc
...
...
@@ -122,8 +122,7 @@ int tsStreamCompRetryDelay = 10; // the stream computing delay
int
tsProjectExecInterval
=
10000
;
// every 10sec, the projection will be executed once
int64_t
tsMaxRetentWindow
=
24
*
3600L
;
// maximum time window tolerance
int
tsUDPSocket
=
1
;
// use UDP by default, if tsUDPSocket equals to 0, all connection use TCP socket
char
tsSocketType
[
4
]
=
"udp"
;
// use UDP by default[option: udp, tcp]
char
tsHttpIp
[
TSDB_IPv4ADDR_LEN
]
=
"0.0.0.0"
;
short
tsHttpPort
=
6020
;
// only tcp, range tcp[6020]
// short tsNginxPort = 6060; //only tcp, range tcp[6060]
...
...
@@ -500,8 +499,8 @@ void tsInitGlobalConfig() {
TSDB_PASSWORD_LEN
,
TSDB_CFG_UTYPE_NONE
);
// socket type, udp by default
tsInitConfigOption
(
cfg
++
,
"
udpsocket"
,
&
tsUDPSocket
,
TSDB_CFG_VTYPE_INT
,
TSDB_CFG_CTYPE_B_CONFIG
|
TSDB_CFG_CTYPE_B_CLIENT
|
TSDB_CFG_CTYPE_B_SHOW
,
0
,
1
,
1
,
TSDB_CFG_UTYPE_NONE
);
tsInitConfigOption
(
cfg
++
,
"
sockettype"
,
tsSocketType
,
TSDB_CFG_VTYPE_STRING
,
TSDB_CFG_CTYPE_B_CONFIG
|
TSDB_CFG_CTYPE_B_CLIENT
|
TSDB_CFG_CTYPE_B_SHOW
,
0
,
0
,
3
,
TSDB_CFG_UTYPE_NONE
);
// locale & charset
tsInitConfigOption
(
cfg
++
,
"timezone"
,
tsTimezone
,
TSDB_CFG_VTYPE_STRING
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录