Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
07e6caa3
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
07e6caa3
编写于
2月 22, 2020
作者:
S
slguan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
shell can connect to server
上级
d43c0ab2
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
72 addition
and
58 deletion
+72
-58
src/client/inc/tsclient.h
src/client/inc/tsclient.h
+2
-0
src/client/src/tscServer.c
src/client/src/tscServer.c
+0
-2
src/client/src/tscSql.c
src/client/src/tscSql.c
+5
-5
src/client/src/tscSystem.c
src/client/src/tscSystem.c
+55
-37
src/kit/shell/src/shellEngine.c
src/kit/shell/src/shellEngine.c
+2
-0
src/kit/shell/src/shellMain.c
src/kit/shell/src/shellMain.c
+1
-5
src/mnode/src/mgmtShell.c
src/mnode/src/mgmtShell.c
+7
-9
未找到文件。
src/client/inc/tsclient.h
浏览文件 @
07e6caa3
...
@@ -371,6 +371,8 @@ typedef struct _sstream {
...
@@ -371,6 +371,8 @@ typedef struct _sstream {
struct
_sstream
*
prev
,
*
next
;
struct
_sstream
*
prev
,
*
next
;
}
SSqlStream
;
}
SSqlStream
;
int32_t
tscInitRpc
(
const
char
*
user
,
const
char
*
secret
);
// tscSql API
// tscSql API
int
tsParseSql
(
SSqlObj
*
pSql
,
bool
multiVnodeInsertion
);
int
tsParseSql
(
SSqlObj
*
pSql
,
bool
multiVnodeInsertion
);
...
...
src/client/src/tscServer.c
浏览文件 @
07e6caa3
...
@@ -166,8 +166,6 @@ void tscProcessActivityTimer(void *handle, void *tmrId) {
...
@@ -166,8 +166,6 @@ void tscProcessActivityTimer(void *handle, void *tmrId) {
if
(
tscShouldFreeHeatBeat
(
pObj
->
pHb
))
{
if
(
tscShouldFreeHeatBeat
(
pObj
->
pHb
))
{
tscTrace
(
"%p free HB object and release connection"
,
pObj
);
tscTrace
(
"%p free HB object and release connection"
,
pObj
);
//taosCloseRpcConn(pObj->pHb->thandle);
tscFreeSqlObj
(
pObj
->
pHb
);
tscFreeSqlObj
(
pObj
->
pHb
);
tscCloseTscObj
(
pObj
);
tscCloseTscObj
(
pObj
);
return
;
return
;
...
...
src/client/src/tscSql.c
浏览文件 @
07e6caa3
...
@@ -36,11 +36,6 @@ TAOS *taos_connect_imp(const char *ip, const char *user, const char *pass, const
...
@@ -36,11 +36,6 @@ TAOS *taos_connect_imp(const char *ip, const char *user, const char *pass, const
taos_init
();
taos_init
();
if
(
pTscMgmtConn
==
NULL
||
pVnodeConn
==
NULL
)
{
globalCode
=
TSDB_CODE_APP_ERROR
;
return
NULL
;
}
if
(
user
==
NULL
)
{
if
(
user
==
NULL
)
{
globalCode
=
TSDB_CODE_INVALID_ACCT
;
globalCode
=
TSDB_CODE_INVALID_ACCT
;
return
NULL
;
return
NULL
;
...
@@ -63,6 +58,11 @@ TAOS *taos_connect_imp(const char *ip, const char *user, const char *pass, const
...
@@ -63,6 +58,11 @@ TAOS *taos_connect_imp(const char *ip, const char *user, const char *pass, const
}
}
}
}
if
(
tscInitRpc
(
user
,
pass
)
!=
0
)
{
globalCode
=
TSDB_CODE_NETWORK_UNAVAIL
;
return
NULL
;
}
if
(
ip
&&
ip
[
0
])
{
if
(
ip
&&
ip
[
0
])
{
tscMgmtIpList
.
index
=
0
;
tscMgmtIpList
.
index
=
0
;
tscMgmtIpList
.
port
=
tsMgmtShellPort
;
tscMgmtIpList
.
port
=
tsMgmtShellPort
;
...
...
src/client/src/tscSystem.c
浏览文件 @
07e6caa3
...
@@ -45,6 +45,7 @@ int tsInsertHeadSize;
...
@@ -45,6 +45,7 @@ int tsInsertHeadSize;
extern
int
tscEmbedded
;
extern
int
tscEmbedded
;
int
tscNumOfThreads
;
int
tscNumOfThreads
;
static
pthread_once_t
tscinit
=
PTHREAD_ONCE_INIT
;
static
pthread_once_t
tscinit
=
PTHREAD_ONCE_INIT
;
static
pthread_mutex_t
tscMutex
;
extern
int
tsTscEnableRecordSql
;
extern
int
tsTscEnableRecordSql
;
extern
int
tsNumOfLogLines
;
extern
int
tsNumOfLogLines
;
...
@@ -56,11 +57,64 @@ void tscCheckDiskUsage(void *para, void *unused) {
...
@@ -56,11 +57,64 @@ void tscCheckDiskUsage(void *para, void *unused) {
taosTmrReset
(
tscCheckDiskUsage
,
1000
,
NULL
,
tscTmr
,
&
tscCheckDiskUsageTmr
);
taosTmrReset
(
tscCheckDiskUsage
,
1000
,
NULL
,
tscTmr
,
&
tscCheckDiskUsageTmr
);
}
}
int32_t
tscInitRpc
(
const
char
*
user
,
const
char
*
secret
)
{
SRpcInit
rpcInit
;
char
secretEncrypt
[
32
]
=
{
0
};
taosEncryptPass
((
uint8_t
*
)
secret
,
strlen
(
secret
),
secretEncrypt
);
pthread_mutex_lock
(
&
tscMutex
);
if
(
pVnodeConn
==
NULL
)
{
memset
(
&
rpcInit
,
0
,
sizeof
(
rpcInit
));
rpcInit
.
localIp
=
tsLocalIp
;
rpcInit
.
localPort
=
0
;
rpcInit
.
label
=
"TSC-vnode"
;
rpcInit
.
numOfThreads
=
tscNumOfThreads
;
rpcInit
.
cfp
=
tscProcessMsgFromServer
;
rpcInit
.
sessions
=
tsMaxVnodeConnections
;
rpcInit
.
connType
=
TAOS_CONN_CLIENT
;
rpcInit
.
user
=
user
;
rpcInit
.
ckey
=
"key"
;
rpcInit
.
secret
=
secretEncrypt
;
pVnodeConn
=
rpcOpen
(
&
rpcInit
);
if
(
pVnodeConn
==
NULL
)
{
tscError
(
"failed to init connection to vnode"
);
pthread_mutex_unlock
(
&
tscMutex
);
return
-
1
;
}
}
if
(
pTscMgmtConn
==
NULL
)
{
memset
(
&
rpcInit
,
0
,
sizeof
(
rpcInit
));
rpcInit
.
localIp
=
tsLocalIp
;
rpcInit
.
localPort
=
0
;
rpcInit
.
label
=
"TSC-mgmt"
;
rpcInit
.
numOfThreads
=
1
;
rpcInit
.
cfp
=
tscProcessMsgFromServer
;
rpcInit
.
sessions
=
tsMaxMgmtConnections
;
rpcInit
.
connType
=
TAOS_CONN_CLIENT
;
rpcInit
.
idleTime
=
2000
;
rpcInit
.
user
=
"root"
;
rpcInit
.
ckey
=
"key"
;
rpcInit
.
secret
=
secretEncrypt
;
pTscMgmtConn
=
rpcOpen
(
&
rpcInit
);
if
(
pTscMgmtConn
==
NULL
)
{
tscError
(
"failed to init connection to mgmt"
);
pthread_mutex_unlock
(
&
tscMutex
);
return
-
1
;
}
}
pthread_mutex_unlock
(
&
tscMutex
);
return
0
;
}
void
taos_init_imp
()
{
void
taos_init_imp
()
{
char
temp
[
128
];
char
temp
[
128
];
struct
stat
dirstat
;
struct
stat
dirstat
;
SRpcInit
rpcInit
;
pthread_mutex_init
(
&
tscMutex
,
NULL
);
srand
(
taosGetTimestampSec
());
srand
(
taosGetTimestampSec
());
deltaToUtcInitOnce
();
deltaToUtcInitOnce
();
...
@@ -124,42 +178,6 @@ void taos_init_imp() {
...
@@ -124,42 +178,6 @@ void taos_init_imp() {
return
;
return
;
}
}
memset
(
&
rpcInit
,
0
,
sizeof
(
rpcInit
));
rpcInit
.
localIp
=
"0.0.0.0"
;
//tsLocalIp;
rpcInit
.
localPort
=
0
;
rpcInit
.
label
=
"TSC-vnode"
;
rpcInit
.
numOfThreads
=
tscNumOfThreads
;
rpcInit
.
cfp
=
tscProcessMsgFromServer
;
rpcInit
.
sessions
=
tsMaxVnodeConnections
;
rpcInit
.
connType
=
TAOS_CONN_CLIENT
;
pVnodeConn
=
rpcOpen
(
&
rpcInit
);
if
(
pVnodeConn
==
NULL
)
{
tscError
(
"failed to init connection to vnode"
);
return
;
}
memset
(
&
rpcInit
,
0
,
sizeof
(
rpcInit
));
rpcInit
.
localIp
=
"0.0.0.0"
;
//tsLocalIp;
rpcInit
.
localPort
=
0
;
rpcInit
.
label
=
"TSC-mgmt"
;
rpcInit
.
numOfThreads
=
1
;
rpcInit
.
cfp
=
tscProcessMsgFromServer
;
rpcInit
.
sessions
=
tsMaxMgmtConnections
;
rpcInit
.
connType
=
TAOS_CONN_CLIENT
;
rpcInit
.
idleTime
=
2000
;
rpcInit
.
user
=
"root"
;
rpcInit
.
ckey
=
"key"
;
char
secret
[
32
]
=
{
0
};
taosEncryptPass
((
uint8_t
*
)
"taosdata"
,
strlen
(
"taosdata"
),
secret
);
rpcInit
.
secret
=
secret
;
pTscMgmtConn
=
rpcOpen
(
&
rpcInit
);
if
(
pTscMgmtConn
==
NULL
)
{
tscError
(
"failed to init connection to mgmt"
);
return
;
}
tscTmr
=
taosTmrInit
(
tsMaxMgmtConnections
*
2
,
200
,
60000
,
"TSC"
);
tscTmr
=
taosTmrInit
(
tsMaxMgmtConnections
*
2
,
200
,
60000
,
"TSC"
);
if
(
0
==
tscEmbedded
){
if
(
0
==
tscEmbedded
){
taosTmrReset
(
tscCheckDiskUsage
,
10
,
NULL
,
tscTmr
,
&
tscCheckDiskUsageTmr
);
taosTmrReset
(
tscCheckDiskUsage
,
10
,
NULL
,
tscTmr
,
&
tscCheckDiskUsageTmr
);
...
...
src/kit/shell/src/shellEngine.c
浏览文件 @
07e6caa3
...
@@ -800,6 +800,8 @@ void source_file(TAOS *con, char *fptr) {
...
@@ -800,6 +800,8 @@ void source_file(TAOS *con, char *fptr) {
}
}
void
shellGetGrantInfo
(
void
*
con
)
{
void
shellGetGrantInfo
(
void
*
con
)
{
return
;
char
sql
[]
=
"show grants"
;
char
sql
[]
=
"show grants"
;
int
code
=
taos_query
(
con
,
sql
);
int
code
=
taos_query
(
con
,
sql
);
...
...
src/kit/shell/src/shellMain.c
浏览文件 @
07e6caa3
...
@@ -81,10 +81,6 @@ struct arguments args = {
...
@@ -81,10 +81,6 @@ struct arguments args = {
*/
*/
int
main
(
int
argc
,
char
*
argv
[])
{
int
main
(
int
argc
,
char
*
argv
[])
{
/*setlocale(LC_ALL, "en_US.UTF-8"); */
/*setlocale(LC_ALL, "en_US.UTF-8"); */
//
void
*
taos
=
taos_connect
(
NULL
,
"root"
,
"taosdata"
,
NULL
,
0
);
printf
(
"ok
\n
"
);
//
if
(
!
checkVersion
())
{
if
(
!
checkVersion
())
{
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
...
...
src/mnode/src/mgmtShell.c
浏览文件 @
07e6caa3
...
@@ -1230,20 +1230,18 @@ int32_t mgmtProcessHeartBeatMsg(void *pCont, int32_t contLen, void *ahandle) {
...
@@ -1230,20 +1230,18 @@ int32_t mgmtProcessHeartBeatMsg(void *pCont, int32_t contLen, void *ahandle) {
}
}
int32_t
mgmtRetriveUserAuthInfo
(
char
*
user
,
char
*
spi
,
char
*
encrypt
,
char
*
secret
,
char
*
ckey
)
{
int32_t
mgmtRetriveUserAuthInfo
(
char
*
user
,
char
*
spi
,
char
*
encrypt
,
char
*
secret
,
char
*
ckey
)
{
SUserObj
*
pUser
=
mgmtGetUser
(
user
);
if
(
pUser
==
NULL
)
{
*
spi
=
0
;
*
spi
=
0
;
*
encrypt
=
0
;
*
encrypt
=
0
;
*
ckey
=
0
;
*
ckey
=
0
;
SUserObj
*
pUser
=
mgmtGetUser
(
user
);
if
(
pUser
==
NULL
)
{
*
secret
=
0
;
*
secret
=
0
;
return
TSDB_CODE_INVALID_USER
;
return
TSDB_CODE_INVALID_USER
;
}
}
else
{
*
spi
=
0
;
*
encrypt
=
0
;
*
ckey
=
0
;
memcpy
(
secret
,
pUser
->
pass
,
TSDB_KEY_LEN
);
memcpy
(
secret
,
pUser
->
pass
,
TSDB_KEY_LEN
);
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
}
static
int32_t
mgmtProcessConnectMsg
(
void
*
pCont
,
int32_t
contLen
,
void
*
thandle
)
{
static
int32_t
mgmtProcessConnectMsg
(
void
*
pCont
,
int32_t
contLen
,
void
*
thandle
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录