Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
c5e9b6ab
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1187
Star
22018
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看板
未验证
提交
c5e9b6ab
编写于
10月 18, 2022
作者:
S
Shengliang Guan
提交者:
GitHub
10月 18, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #17402 from taosdata/fix/TD-19259
fix: fix coverity scan problem
上级
aa355188
b5f76232
变更
15
隐藏空白更改
内联
并排
Showing
15 changed file
with
79 addition
and
60 deletion
+79
-60
source/dnode/vnode/src/meta/metaQuery.c
source/dnode/vnode/src/meta/metaQuery.c
+15
-17
source/dnode/vnode/src/meta/metaTable.c
source/dnode/vnode/src/meta/metaTable.c
+4
-1
source/libs/index/inc/indexInt.h
source/libs/index/inc/indexInt.h
+1
-1
source/libs/index/src/index.c
source/libs/index/src/index.c
+1
-1
source/libs/index/src/indexCache.c
source/libs/index/src/indexCache.c
+7
-5
source/libs/index/src/indexComm.c
source/libs/index/src/indexComm.c
+1
-0
source/libs/index/src/indexFilter.c
source/libs/index/src/indexFilter.c
+14
-14
source/libs/index/src/indexFst.c
source/libs/index/src/indexFst.c
+1
-1
source/libs/index/src/indexFstFile.c
source/libs/index/src/indexFstFile.c
+4
-2
source/libs/index/src/indexTfile.c
source/libs/index/src/indexTfile.c
+10
-2
source/libs/transport/src/thttp.c
source/libs/transport/src/thttp.c
+1
-1
source/libs/transport/src/trans.c
source/libs/transport/src/trans.c
+2
-6
source/libs/transport/src/transCli.c
source/libs/transport/src/transCli.c
+10
-8
source/os/src/osSocket.c
source/os/src/osSocket.c
+7
-1
source/util/src/tsched.c
source/util/src/tsched.c
+1
-0
未找到文件。
source/dnode/vnode/src/meta/metaQuery.c
浏览文件 @
c5e9b6ab
...
...
@@ -1059,7 +1059,7 @@ int32_t metaFilterTableIds(SMeta *pMeta, SMetaFltParam *param, SArray *pUids) {
if
(
param
->
val
==
NULL
)
{
metaError
(
"vgId:%d, failed to filter NULL data"
,
TD_VID
(
pMeta
->
pVnode
));
return
-
1
;
goto
END
;
}
else
{
if
(
IS_VAR_DATA_TYPE
(
param
->
type
))
{
tagData
=
varDataVal
(
param
->
val
);
...
...
@@ -1111,27 +1111,25 @@ int32_t metaFilterTableIds(SMeta *pMeta, SMetaFltParam *param, SArray *pUids) {
break
;
}
}
if
(
p
->
suid
!=
pKey
->
suid
)
{
if
(
p
==
NULL
||
p
->
suid
!=
pKey
->
suid
)
{
break
;
}
first
=
false
;
if
(
p
!=
NULL
)
{
int32_t
cmp
=
(
*
param
->
filterFunc
)(
p
->
data
,
pKey
->
data
,
pKey
->
type
);
if
(
cmp
==
0
)
{
// match
tb_uid_t
tuid
=
0
;
if
(
IS_VAR_DATA_TYPE
(
pKey
->
type
))
{
tuid
=
*
(
tb_uid_t
*
)(
p
->
data
+
varDataTLen
(
p
->
data
));
}
else
{
tuid
=
*
(
tb_uid_t
*
)(
p
->
data
+
tDataTypes
[
pCursor
->
type
].
bytes
);
}
taosArrayPush
(
pUids
,
&
tuid
);
}
else
if
(
cmp
==
1
)
{
// not match but should continue to iter
int32_t
cmp
=
(
*
param
->
filterFunc
)(
p
->
data
,
pKey
->
data
,
pKey
->
type
);
if
(
cmp
==
0
)
{
// match
tb_uid_t
tuid
=
0
;
if
(
IS_VAR_DATA_TYPE
(
pKey
->
type
))
{
tuid
=
*
(
tb_uid_t
*
)(
p
->
data
+
varDataTLen
(
p
->
data
));
}
else
{
// not match and no more result
break
;
tuid
=
*
(
tb_uid_t
*
)(
p
->
data
+
tDataTypes
[
pCursor
->
type
].
bytes
);
}
taosArrayPush
(
pUids
,
&
tuid
);
}
else
if
(
cmp
==
1
)
{
// not match but should continue to iter
}
else
{
// not match and no more result
break
;
}
valid
=
param
->
reverse
?
tdbTbcMoveToPrev
(
pCursor
->
pCur
)
:
tdbTbcMoveToNext
(
pCursor
->
pCur
);
if
(
valid
<
0
)
{
...
...
source/dnode/vnode/src/meta/metaTable.c
浏览文件 @
c5e9b6ab
...
...
@@ -116,9 +116,10 @@ static int metaSaveJsonVarToIdx(SMeta *pMeta, const SMetaEntry *pCtbEntry, const
indexMultiTermAdd
(
terms
,
term
);
}
}
taosArrayDestroy
(
pTagVals
);
indexJsonPut
(
pMeta
->
pTagIvtIdx
,
terms
,
tuid
);
indexMultiTermDestroy
(
terms
);
taosArrayDestroy
(
pTagVals
);
#endif
return
0
;
}
...
...
@@ -159,6 +160,7 @@ int metaDelJsonVarFromIdx(SMeta *pMeta, const SMetaEntry *pCtbEntry, const SSche
memcpy
(
val
,
(
uint16_t
*
)
&
len
,
VARSTR_HEADER_SIZE
);
type
=
TSDB_DATA_TYPE_VARCHAR
;
term
=
indexTermCreate
(
suid
,
DEL_VALUE
,
type
,
key
,
nKey
,
val
,
len
);
taosMemoryFree
(
val
);
}
else
if
(
pTagVal
->
nData
==
0
)
{
term
=
indexTermCreate
(
suid
,
DEL_VALUE
,
TSDB_DATA_TYPE_VARCHAR
,
key
,
nKey
,
pTagVal
->
pData
,
0
);
}
...
...
@@ -177,6 +179,7 @@ int metaDelJsonVarFromIdx(SMeta *pMeta, const SMetaEntry *pCtbEntry, const SSche
}
indexJsonPut
(
pMeta
->
pTagIvtIdx
,
terms
,
tuid
);
indexMultiTermDestroy
(
terms
);
taosArrayDestroy
(
pTagVals
);
#endif
return
0
;
}
...
...
source/libs/index/inc/indexInt.h
浏览文件 @
c5e9b6ab
...
...
@@ -138,7 +138,7 @@ void idxReleaseRef(int64_t ref);
#define IDX_TYPE_ADD_EXTERN_TYPE(ty, exTy) \
do { \
uint8_t oldTy = ty; \
ty = (
ty >> 4) | exTy;
\
ty = (
(ty >> 4) & 0xFF) | exTy;
\
ty = (ty << 4) | oldTy; \
} while (0)
...
...
source/libs/index/src/index.c
浏览文件 @
c5e9b6ab
...
...
@@ -139,7 +139,7 @@ int indexOpen(SIndexOpts* opts, const char* path, SIndex** index) {
END:
if
(
idx
!=
NULL
)
{
index
Close
(
idx
);
index
Destroy
(
idx
);
}
*
index
=
NULL
;
return
ret
;
...
...
source/libs/index/src/indexCache.c
浏览文件 @
c5e9b6ab
...
...
@@ -538,7 +538,7 @@ int idxCachePut(void* cache, SIndexTerm* term, uint64_t uid) {
idxCacheRef
(
pCache
);
// encode data
CacheTerm
*
ct
=
taosMemoryCalloc
(
1
,
sizeof
(
CacheTerm
));
if
(
c
ache
==
NULL
)
{
if
(
c
t
==
NULL
)
{
return
-
1
;
}
// set up key
...
...
@@ -730,15 +730,17 @@ static int32_t idxCacheJsonTermCompare(const void* l, const void* r) {
return
cmp
;
}
static
MemTable
*
idxInternalCacheCreate
(
int8_t
type
)
{
int
ttype
=
IDX_TYPE_CONTAIN_EXTERN_TYPE
(
type
,
TSDB_DATA_TYPE_JSON
)
?
TSDB_DATA_TYPE_BINARY
:
TSDB_DATA_TYPE_BINARY
;
// int ttype = IDX_TYPE_CONTAIN_EXTERN_TYPE(type, TSDB_DATA_TYPE_JSON) ? TSDB_DATA_TYPE_BINARY :
// TSDB_DATA_TYPE_BINARY;
int
ttype
=
TSDB_DATA_TYPE_BINARY
;
int32_t
(
*
cmpFn
)(
const
void
*
l
,
const
void
*
r
)
=
IDX_TYPE_CONTAIN_EXTERN_TYPE
(
type
,
TSDB_DATA_TYPE_JSON
)
?
idxCacheJsonTermCompare
:
idxCacheTermCompare
;
MemTable
*
tbl
=
taosMemoryCalloc
(
1
,
sizeof
(
MemTable
));
idxMemRef
(
tbl
);
if
(
ttype
==
TSDB_DATA_TYPE_BINARY
||
ttype
==
TSDB_DATA_TYPE_NCHAR
)
{
tbl
->
mem
=
tSkipListCreate
(
MAX_SKIP_LIST_LEVEL
,
ttype
,
MAX_INDEX_KEY_LEN
,
cmpFn
,
SL_ALLOW_DUP_KEY
,
idxCacheTermGet
);
}
//
if (ttype == TSDB_DATA_TYPE_BINARY || ttype == TSDB_DATA_TYPE_NCHAR) {
tbl
->
mem
=
tSkipListCreate
(
MAX_SKIP_LIST_LEVEL
,
ttype
,
MAX_INDEX_KEY_LEN
,
cmpFn
,
SL_ALLOW_DUP_KEY
,
idxCacheTermGet
);
//
}
return
tbl
;
}
...
...
source/libs/index/src/indexComm.c
浏览文件 @
c5e9b6ab
...
...
@@ -427,6 +427,7 @@ int32_t idxConvertDataToStr(void* src, int8_t type, void** dst) {
*
dst
=
taosMemoryCalloc
(
1
,
bufSize
+
1
);
idxInt2str
(
*
(
uint64_t
*
)
src
,
*
dst
,
1
);
tlen
=
strlen
(
*
dst
);
break
;
case
TSDB_DATA_TYPE_FLOAT
:
*
dst
=
taosMemoryCalloc
(
1
,
bufSize
+
1
);
sprintf
(
*
dst
,
"%.9lf"
,
*
(
float
*
)
src
);
...
...
source/libs/index/src/indexFilter.c
浏览文件 @
c5e9b6ab
...
...
@@ -231,7 +231,9 @@ static int32_t sifInitParam(SNode *node, SIFParam *param, SIFCtx *ctx) {
SIF_ERR_RET
(
sifGetValueFromNode
(
node
,
&
param
->
condValue
));
param
->
colId
=
-
1
;
param
->
colValType
=
(
uint8_t
)(
vn
->
node
.
resType
.
type
);
memcpy
(
param
->
colName
,
vn
->
literal
,
strlen
(
vn
->
literal
));
if
(
strlen
(
vn
->
literal
)
<=
sizeof
(
param
->
colName
))
{
memcpy
(
param
->
colName
,
vn
->
literal
,
strlen
(
vn
->
literal
));
}
break
;
}
case
QUERY_NODE_COLUMN
:
{
...
...
@@ -400,54 +402,52 @@ static FORCE_INLINE FilterFunc sifGetFilterFunc(EIndexQueryType type, bool *reve
static
void
sifSetFltParam
(
SIFParam
*
left
,
SIFParam
*
right
,
SDataTypeBuf
*
typedata
,
SMetaFltParam
*
param
)
{
int8_t
ltype
=
left
->
colValType
,
rtype
=
right
->
colValType
;
if
(
ltype
==
TSDB_DATA_TYPE_FLOAT
)
{
float
f
;
float
f
=
0
;
SIF_DATA_CONVERT
(
rtype
,
right
->
condValue
,
f
);
typedata
->
f
=
f
;
param
->
val
=
&
typedata
->
f
;
}
else
if
(
ltype
==
TSDB_DATA_TYPE_DOUBLE
)
{
double
d
;
double
d
=
0
;
SIF_DATA_CONVERT
(
rtype
,
right
->
condValue
,
d
);
typedata
->
d
=
d
;
param
->
val
=
&
typedata
->
d
;
}
else
if
(
ltype
==
TSDB_DATA_TYPE_BIGINT
)
{
int64_t
i64
;
int64_t
i64
=
0
;
SIF_DATA_CONVERT
(
rtype
,
right
->
condValue
,
i64
);
typedata
->
i64
=
i64
;
param
->
val
=
&
typedata
->
i64
;
}
else
if
(
ltype
==
TSDB_DATA_TYPE_INT
)
{
int32_t
i32
;
int32_t
i32
=
0
;
SIF_DATA_CONVERT
(
rtype
,
right
->
condValue
,
i32
);
typedata
->
i32
=
i32
;
param
->
val
=
&
typedata
->
i32
;
}
else
if
(
ltype
==
TSDB_DATA_TYPE_SMALLINT
)
{
int16_t
i16
;
int16_t
i16
=
0
;
SIF_DATA_CONVERT
(
rtype
,
right
->
condValue
,
i16
);
typedata
->
i16
=
i16
;
param
->
val
=
&
typedata
->
i16
;
}
else
if
(
ltype
==
TSDB_DATA_TYPE_TINYINT
)
{
int8_t
i8
;
int8_t
i8
=
0
;
SIF_DATA_CONVERT
(
rtype
,
right
->
condValue
,
i8
)
typedata
->
i8
=
i8
;
param
->
val
=
&
typedata
->
i8
;
}
else
if
(
ltype
==
TSDB_DATA_TYPE_UBIGINT
)
{
uint64_t
u64
;
uint64_t
u64
=
0
;
SIF_DATA_CONVERT
(
rtype
,
right
->
condValue
,
u64
);
typedata
->
u64
=
u64
;
param
->
val
=
&
typedata
->
u64
;
}
else
if
(
ltype
==
TSDB_DATA_TYPE_UINT
)
{
uint32_t
u32
;
uint32_t
u32
=
0
;
SIF_DATA_CONVERT
(
rtype
,
right
->
condValue
,
u32
);
typedata
->
u32
=
u32
;
param
->
val
=
&
typedata
->
u32
;
}
else
if
(
ltype
==
TSDB_DATA_TYPE_USMALLINT
)
{
uint16_t
u16
;
uint16_t
u16
=
0
;
SIF_DATA_CONVERT
(
rtype
,
right
->
condValue
,
u16
);
typedata
->
u16
=
u16
;
param
->
val
=
&
typedata
->
u16
;
}
else
if
(
ltype
==
TSDB_DATA_TYPE_UTINYINT
)
{
uint8_t
u8
;
uint8_t
u8
=
0
;
SIF_DATA_CONVERT
(
rtype
,
right
->
condValue
,
u8
);
typedata
->
u8
=
u8
;
param
->
val
=
&
typedata
->
u8
;
...
...
@@ -663,7 +663,7 @@ static int32_t sifExecOper(SOperatorNode *node, SIFCtx *ctx, SIFParam *output) {
// ugly code, refactor later
if
(
nParam
>
1
&&
params
[
1
].
status
==
SFLT_NOT_INDEX
)
{
output
->
status
=
SFLT_NOT_INDEX
;
return
code
;
goto
_return
;
}
SIF_ERR_JRET
(
sifGetOperFn
(
node
->
opType
,
&
operFn
,
&
output
->
status
));
}
...
...
source/libs/index/src/indexFst.c
浏览文件 @
c5e9b6ab
...
...
@@ -338,7 +338,7 @@ uint8_t fstStateCommInput(FstState* s, bool* null) {
return
v
;
}
// 0 indicate that common_input is None
return
v
==
0
?
0
:
COMMON_INPUT
(
v
);
return
COMMON_INPUT
(
v
);
}
// input_len
...
...
source/libs/index/src/indexFstFile.c
浏览文件 @
c5e9b6ab
...
...
@@ -72,7 +72,8 @@ static int idxFileCtxDoReadFrom(IFileCtx* ctx, uint8_t* buf, int len, int32_t of
if
(
offset
>=
ctx
->
file
.
size
)
return
0
;
do
{
char
key
[
128
]
=
{
0
};
char
key
[
1024
]
=
{
0
};
assert
(
strlen
(
ctx
->
file
.
buf
)
+
1
+
64
<
sizeof
(
key
));
idxGenLRUKey
(
key
,
ctx
->
file
.
buf
,
blkId
);
LRUHandle
*
h
=
taosLRUCacheLookup
(
ctx
->
lru
,
key
,
strlen
(
key
));
...
...
@@ -99,6 +100,7 @@ static int idxFileCtxDoReadFrom(IFileCtx* ctx, uint8_t* buf, int len, int32_t of
assert
(
blk
->
nread
<=
kBlockSize
);
if
(
blk
->
nread
<
kBlockSize
&&
blk
->
nread
<
len
)
{
taosMemoryFree
(
blk
);
break
;
}
...
...
@@ -150,7 +152,7 @@ IFileCtx* idxFileCtxCreate(WriterType type, const char* path, bool readOnly, int
if
(
ctx
->
type
==
TFILE
)
{
// ugly code, refactor later
ctx
->
file
.
readOnly
=
readOnly
;
memcpy
(
ctx
->
file
.
buf
,
path
,
s
trlen
(
path
));
memcpy
(
ctx
->
file
.
buf
,
path
,
s
izeof
(
ctx
->
file
.
buf
));
if
(
readOnly
==
false
)
{
ctx
->
file
.
pFile
=
taosOpenFile
(
path
,
TD_FILE_CREATE
|
TD_FILE_WRITE
|
TD_FILE_APPEND
);
taosFtruncateFile
(
ctx
->
file
.
pFile
,
0
);
...
...
source/libs/index/src/indexTfile.c
浏览文件 @
c5e9b6ab
...
...
@@ -506,7 +506,9 @@ TFileWriter* tfileWriterOpen(char* path, uint64_t suid, int64_t version, const c
tfh
.
suid
=
suid
;
tfh
.
version
=
version
;
tfh
.
colType
=
colType
;
memcpy
(
tfh
.
colName
,
colName
,
strlen
(
colName
));
if
(
strlen
(
colName
)
<=
sizeof
(
tfh
.
colName
))
{
memcpy
(
tfh
.
colName
,
colName
,
strlen
(
colName
));
}
return
tfileWriterCreate
(
wcx
,
&
tfh
);
}
...
...
@@ -580,8 +582,14 @@ int tfileWriterPut(TFileWriter* tw, void* data, bool order) {
if
(
cap
<
ttsz
)
{
cap
=
ttsz
;
buf
=
(
char
*
)
taosMemoryRealloc
(
buf
,
cap
);
char
*
t
=
(
char
*
)
taosMemoryRealloc
(
buf
,
cap
);
if
(
t
==
NULL
)
{
taosMemoryFree
(
buf
);
return
-
1
;
}
buf
=
t
;
}
char
*
p
=
buf
;
tfileSerialTableIdsToBuf
(
p
,
v
->
tableId
);
tw
->
ctx
->
write
(
tw
->
ctx
,
buf
,
ttsz
);
...
...
source/libs/transport/src/thttp.c
浏览文件 @
c5e9b6ab
...
...
@@ -146,7 +146,7 @@ static FORCE_INLINE void clientRecvCb(uv_stream_t* handle, ssize_t nread, const
if
(
nread
<
0
)
{
uError
(
"http-report recv error:%s"
,
uv_err_name
(
nread
));
}
else
{
uTrace
(
"http-report succ to recv %d bytes"
,
nread
);
uTrace
(
"http-report succ to recv %d bytes"
,
(
int32_t
)
nread
);
}
uv_close
((
uv_handle_t
*
)
&
cli
->
tcp
,
clientCloseCb
);
}
...
...
source/libs/transport/src/trans.c
浏览文件 @
c5e9b6ab
...
...
@@ -54,11 +54,7 @@ void* rpcOpen(const SRpcInit* pInit) {
pRpc
->
retry
=
pInit
->
rfp
;
pRpc
->
startTimer
=
pInit
->
tfp
;
if
(
pInit
->
connType
==
TAOS_CONN_SERVER
)
{
pRpc
->
numOfThreads
=
pInit
->
numOfThreads
>
TSDB_MAX_RPC_THREADS
?
TSDB_MAX_RPC_THREADS
:
pInit
->
numOfThreads
;
}
else
{
pRpc
->
numOfThreads
=
pInit
->
numOfThreads
>
TSDB_MAX_RPC_THREADS
?
TSDB_MAX_RPC_THREADS
:
pInit
->
numOfThreads
;
}
pRpc
->
numOfThreads
=
pInit
->
numOfThreads
>
TSDB_MAX_RPC_THREADS
?
TSDB_MAX_RPC_THREADS
:
pInit
->
numOfThreads
;
uint32_t
ip
=
0
;
if
(
pInit
->
connType
==
TAOS_CONN_SERVER
)
{
...
...
@@ -79,7 +75,7 @@ void* rpcOpen(const SRpcInit* pInit) {
}
pRpc
->
parent
=
pInit
->
parent
;
if
(
pInit
->
user
)
{
memcpy
(
pRpc
->
user
,
pInit
->
user
,
strlen
(
pInit
->
user
)
);
memcpy
(
pRpc
->
user
,
pInit
->
user
,
TSDB_UNI_LEN
);
}
int64_t
refId
=
transAddExHandle
(
transGetInstMgt
(),
pRpc
);
...
...
source/libs/transport/src/transCli.c
浏览文件 @
c5e9b6ab
...
...
@@ -267,11 +267,12 @@ static void cliReleaseUnfinishedMsg(SCliConn* conn) {
#define EPSET_GET_SIZE(epSet) (epSet)->numOfEps
#define EPSET_GET_INUSE_IP(epSet) ((epSet)->eps[(epSet)->inUse].fqdn)
#define EPSET_GET_INUSE_PORT(epSet) ((epSet)->eps[(epSet)->inUse].port)
#define EPSET_FORWARD_INUSE(epSet) \
do { \
if ((epSet)->numOfEps != 0) { \
(epSet)->inUse = (++((epSet)->inUse)) % ((epSet)->numOfEps); \
} \
#define EPSET_FORWARD_INUSE(epSet) \
do { \
if ((epSet)->numOfEps != 0) { \
++((epSet)->inUse); \
(epSet)->inUse = ((epSet)->inUse) % ((epSet)->numOfEps); \
} \
} while (0)
#define EPSET_DEBUG_STR(epSet, tbuf) \
...
...
@@ -503,6 +504,7 @@ static SCliConn* getConnFromPool(void* pool, char* ip, uint32_t port) {
SConnList
list
=
{
0
};
taosHashPut
((
SHashObj
*
)
pool
,
key
,
strlen
(
key
),
(
void
*
)
&
list
,
sizeof
(
list
));
plist
=
taosHashGet
((
SHashObj
*
)
pool
,
key
,
strlen
(
key
));
if
(
plist
==
NULL
)
return
NULL
;
QUEUE_INIT
(
&
plist
->
conns
);
}
...
...
@@ -1157,7 +1159,7 @@ void* transInitClient(uint32_t ip, uint32_t port, char* label, int numOfThreads,
SCliObj
*
cli
=
taosMemoryCalloc
(
1
,
sizeof
(
SCliObj
));
STrans
*
pTransInst
=
shandle
;
memcpy
(
cli
->
label
,
label
,
strlen
(
label
)
);
memcpy
(
cli
->
label
,
label
,
TSDB_LABEL_LEN
);
cli
->
numOfThreads
=
numOfThreads
;
cli
->
pThreadObj
=
(
SCliThrd
**
)
taosMemoryCalloc
(
cli
->
numOfThreads
,
sizeof
(
SCliThrd
*
));
...
...
@@ -1611,8 +1613,8 @@ int transSetDefaultAddr(void* shandle, const char* ip, const char* fqdn) {
SCvtAddr
cvtAddr
=
{
0
};
if
(
ip
!=
NULL
&&
fqdn
!=
NULL
)
{
memcpy
(
cvtAddr
.
ip
,
ip
,
strlen
(
ip
));
memcpy
(
cvtAddr
.
fqdn
,
fqdn
,
strlen
(
fqdn
));
if
(
strlen
(
ip
)
<=
sizeof
(
cvtAddr
.
ip
))
memcpy
(
cvtAddr
.
ip
,
ip
,
strlen
(
ip
));
if
(
strlen
(
fqdn
)
<=
sizeof
(
cvtAddr
.
fqdn
))
memcpy
(
cvtAddr
.
fqdn
,
fqdn
,
strlen
(
fqdn
));
cvtAddr
.
cvt
=
true
;
}
for
(
int
i
=
0
;
i
<
pTransInst
->
numOfThreads
;
i
++
)
{
...
...
source/os/src/osSocket.c
浏览文件 @
c5e9b6ab
...
...
@@ -590,7 +590,9 @@ TdSocketPtr taosOpenTcpClientSocket(uint32_t destIp, uint16_t destPort, uint32_t
taosCloseSocket
(
&
pSocket
);
return
NULL
;
}
else
{
taosKeepTcpAlive
(
pSocket
);
if
(
taosKeepTcpAlive
(
pSocket
)
==
-
1
)
{
return
NULL
;
}
}
return
pSocket
;
...
...
@@ -1059,18 +1061,22 @@ int32_t taosCreateSocketWithTimeout(uint32_t timeout) {
}
#if defined(WINDOWS)
if
(
0
!=
setsockopt
(
fd
,
IPPROTO_TCP
,
TCP_MAXRT
,
(
char
*
)
&
timeout
,
sizeof
(
timeout
)))
{
taosCloseSocketNoCheck1
(
fd
);
return
-
1
;
}
#elif defined(_TD_DARWIN_64)
uint32_t
conn_timeout_ms
=
timeout
*
1000
;
if
(
0
!=
setsockopt
(
fd
,
IPPROTO_TCP
,
TCP_CONNECTIONTIMEOUT
,
(
char
*
)
&
conn_timeout_ms
,
sizeof
(
conn_timeout_ms
)))
{
taosCloseSocketNoCheck1
(
fd
);
return
-
1
;
}
#else // Linux like systems
uint32_t
conn_timeout_ms
=
timeout
*
1000
;
if
(
0
!=
setsockopt
(
fd
,
IPPROTO_TCP
,
TCP_USER_TIMEOUT
,
(
char
*
)
&
conn_timeout_ms
,
sizeof
(
conn_timeout_ms
)))
{
taosCloseSocketNoCheck1
(
fd
);
return
-
1
;
}
#endif
return
(
int
)
fd
;
}
source/util/src/tsched.c
浏览文件 @
c5e9b6ab
...
...
@@ -38,6 +38,7 @@ void *taosInitScheduler(int32_t queueSize, int32_t numOfThreads, const char *lab
if
(
pSched
->
queue
==
NULL
)
{
uError
(
"%s: no enough memory for queue"
,
label
);
taosCleanUpScheduler
(
pSched
);
taosMemoryFree
(
pSched
);
return
NULL
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录