Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
镜像
Eclipse Foundation
Eclipse Paho C Client Library for the MQTT Protocol
提交
4b8f58fc
E
Eclipse Paho C Client Library for the MQTT Protocol
项目概览
镜像
/
Eclipse Foundation
/
Eclipse Paho C Client Library for the MQTT Protocol
9 个月 前同步成功
通知
251
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
Eclipse Paho C Client Library for the MQTT Protocol
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
4b8f58fc
编写于
5月 12, 2020
作者:
I
Ian Craggs
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'develop' into coverity-develop
上级
b0fc3010
80831fbb
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
39 addition
and
27 deletion
+39
-27
CMakeLists.txt
CMakeLists.txt
+0
-1
src/Clients.h
src/Clients.h
+15
-15
src/Heap.c
src/Heap.c
+10
-6
src/MQTTAsync.c
src/MQTTAsync.c
+4
-0
src/WebSocket.c
src/WebSocket.c
+10
-5
未找到文件。
CMakeLists.txt
浏览文件 @
4b8f58fc
...
...
@@ -31,7 +31,6 @@ file(READ version.minor PAHO_VERSION_MINOR)
file
(
READ version.patch PAHO_VERSION_PATCH
)
SET
(
CLIENT_VERSION
${
PAHO_VERSION_MAJOR
}
.
${
PAHO_VERSION_MINOR
}
.
${
PAHO_VERSION_PATCH
}
)
ENABLE_LANGUAGE
(
CXX
)
INCLUDE
(
GNUInstallDirs
)
STRING
(
TIMESTAMP BUILD_TIMESTAMP UTC
)
...
...
src/Clients.h
浏览文件 @
4b8f58fc
/*******************************************************************************
* Copyright (c) 2009, 20
19
IBM Corp.
* Copyright (c) 2009, 20
20
IBM Corp.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
...
...
@@ -124,24 +124,24 @@ typedef struct
unsigned
int
good
:
1
;
/**< if we have an error on the socket we turn this off */
unsigned
int
ping_outstanding
:
1
;
signed
int
connect_state
:
4
;
networkHandles
net
;
int
msgID
;
int
keepAliveInterval
;
networkHandles
net
;
/**< network info for this client */
int
msgID
;
/**< the MQTT message id */
int
keepAliveInterval
;
/**< the MQTT keep alive interval */
int
retryInterval
;
int
maxInflightMessages
;
willMessages
*
will
;
List
*
inboundMsgs
;
List
*
outboundMsgs
;
/**<
in flight
*/
List
*
messageQueue
;
int
maxInflightMessages
;
/**< the max number of inflight outbound messages we allow */
willMessages
*
will
;
/**< the MQTT will message, if any */
List
*
inboundMsgs
;
/**< inbound in flight messages */
List
*
outboundMsgs
;
/**<
outbound in flight messages
*/
List
*
messageQueue
;
/**< inbound complete but undelivered messages */
unsigned
int
qentry_seqno
;
void
*
phandle
;
/*
the persistence handle */
MQTTClient_persistence
*
persistence
;
/* a persistence implementation */
void
*
phandle
;
/**<
the persistence handle */
MQTTClient_persistence
*
persistence
;
/*
*<
a persistence implementation */
void
*
context
;
/* calling context - used when calling disconnect_internal */
int
MQTTVersion
;
int
sessionExpiry
;
/**< MQTT 5 session expiry */
int
MQTTVersion
;
/**< the version of MQTT being used, 3, 4 or 5 */
int
sessionExpiry
;
/**< MQTT 5 session expiry */
#if defined(OPENSSL)
MQTTClient_SSLOptions
*
sslopts
;
SSL_SESSION
*
session
;
/*
**< SSL session pointer for fast handhake */
MQTTClient_SSLOptions
*
sslopts
;
/**< the SSL/TLS connect options */
SSL_SESSION
*
session
;
/
**< SSL session pointer for fast handhake */
#endif
}
Clients
;
...
...
src/Heap.c
浏览文件 @
4b8f58fc
...
...
@@ -160,13 +160,14 @@ void* mymalloc(char* file, int line, size_t size)
storageElement
*
s
=
NULL
;
size_t
space
=
sizeof
(
storageElement
);
size_t
filenamelen
=
strlen
(
file
)
+
1
;
void
*
rc
=
NULL
;
Thread_lock_mutex
(
heap_mutex
);
size
=
Heap_roundup
(
size
);
if
((
s
=
malloc
(
sizeof
(
storageElement
)))
==
NULL
)
{
Log
(
LOG_ERROR
,
13
,
errmsg
);
return
NULL
;
goto
exit
;
}
memset
(
s
,
0
,
sizeof
(
storageElement
));
...
...
@@ -175,7 +176,7 @@ void* mymalloc(char* file, int line, size_t size)
{
Log
(
LOG_ERROR
,
13
,
errmsg
);
free
(
s
);
return
NULL
;
goto
exit
;
}
memset
(
s
->
file
,
0
,
sizeof
(
filenamelen
));
...
...
@@ -188,7 +189,7 @@ void* mymalloc(char* file, int line, size_t size)
Log
(
LOG_ERROR
,
13
,
errmsg
);
free
(
s
->
file
);
free
(
s
);
return
NULL
;
goto
exit
;
}
memset
(
s
->
stack
,
0
,
sizeof
(
filenamelen
));
StackTrace_get
(
Thread_getid
(),
s
->
stack
,
STACK_LEN
);
...
...
@@ -200,7 +201,7 @@ void* mymalloc(char* file, int line, size_t size)
Log
(
LOG_ERROR
,
13
,
errmsg
);
free
(
s
->
file
);
free
(
s
);
return
NULL
;
goto
exit
;
}
memset
(
s
->
ptr
,
0
,
size
+
2
*
sizeof
(
eyecatcherType
));
space
+=
size
+
2
*
sizeof
(
eyecatcherType
);
...
...
@@ -211,8 +212,10 @@ void* mymalloc(char* file, int line, size_t size)
state
.
current_size
+=
size
;
if
(
state
.
current_size
>
state
.
max_size
)
state
.
max_size
=
state
.
current_size
;
rc
=
((
eyecatcherType
*
)(
s
->
ptr
))
+
1
;
/* skip start eyecatcher */
exit:
Thread_unlock_mutex
(
heap_mutex
);
return
((
eyecatcherType
*
)(
s
->
ptr
))
+
1
;
/* skip start eyecatcher */
return
rc
;
}
...
...
@@ -336,7 +339,7 @@ void *myrealloc(char* file, int line, void* p, size_t size)
if
((
s
->
ptr
=
realloc
(
s
->
ptr
,
size
+
2
*
sizeof
(
eyecatcherType
)))
==
NULL
)
{
Log
(
LOG_ERROR
,
13
,
errmsg
);
return
NULL
;
goto
exit
;
}
space
+=
size
+
2
*
sizeof
(
eyecatcherType
)
-
s
->
size
;
*
(
eyecatcherType
*
)(
s
->
ptr
)
=
eyecatcher
;
/* start eyecatcher */
...
...
@@ -350,6 +353,7 @@ void *myrealloc(char* file, int line, void* p, size_t size)
rc
=
s
->
ptr
;
TreeAdd
(
&
heap
,
s
,
space
);
}
exit:
Thread_unlock_mutex
(
heap_mutex
);
return
(
rc
==
NULL
)
?
NULL
:
((
eyecatcherType
*
)(
rc
))
+
1
;
/* skip start eyecatcher */
}
...
...
src/MQTTAsync.c
浏览文件 @
4b8f58fc
...
...
@@ -3472,6 +3472,7 @@ static int MQTTAsync_assignMsgId(MQTTAsyncs* m)
msgid
=
(
msgid
==
MAX_MSG_ID
)
?
1
:
msgid
+
1
;
while
(
ListFindItem
(
commands
,
&
msgid
,
cmdMessageIDCompare
)
||
ListFindItem
(
m
->
c
->
outboundMsgs
,
&
msgid
,
messageIDCompare
)
||
ListFindItem
(
m
->
responses
,
&
msgid
,
cmdMessageIDCompare
))
{
msgid
=
(
msgid
==
MAX_MSG_ID
)
?
1
:
msgid
+
1
;
...
...
@@ -3785,12 +3786,15 @@ int MQTTAsync_send(MQTTAsync handle, const char* destinationName, int payloadlen
}
if
((
pub
->
command
.
details
.
pub
.
destinationName
=
MQTTStrdup
(
destinationName
))
==
NULL
)
{
free
(
pub
);
rc
=
PAHO_MEMORY_ERROR
;
goto
exit
;
}
pub
->
command
.
details
.
pub
.
payloadlen
=
payloadlen
;
if
((
pub
->
command
.
details
.
pub
.
payload
=
malloc
(
payloadlen
))
==
NULL
)
{
free
(
pub
->
command
.
details
.
pub
.
destinationName
);
free
(
pub
);
rc
=
PAHO_MEMORY_ERROR
;
goto
exit
;
}
...
...
src/WebSocket.c
浏览文件 @
4b8f58fc
...
...
@@ -345,12 +345,14 @@ static void WebSocket_unmaskData(uint8_t *mask, size_t idx, int count, char** bu
{
int
i
;
FUNC_ENTRY
;
for
(
i
=
0
;
i
<
count
;
++
i
)
{
size_t
j
;
for
(
j
=
0u
;
j
<
buflens
[
i
];
++
j
,
++
idx
)
buffers
[
i
][
j
]
^=
mask
[
idx
%
4
];
}
FUNC_EXIT
;
}
...
...
@@ -912,9 +914,12 @@ int WebSocket_putdatas(networkHandles* net, char** buf0, size_t* buf0len,
#endif
rc
=
Socket_putdatas
(
net
->
socket
,
wsdata
.
wsbuf0
,
wsdata
.
wsbuf0len
,
count
,
buffers
,
buflens
,
freeData
);
if
(
mask_data
)
WebSocket_unmaskData
(
wsdata
.
mask
,
*
buf0len
,
count
,
buffers
,
buflens
);
free
(
wsdata
.
wsbuf0
);
/* free temporary ws header */
if
(
rc
!=
TCPSOCKET_INTERRUPTED
)
{
if
(
mask_data
)
WebSocket_unmaskData
(
wsdata
.
mask
,
*
buf0len
,
count
,
buffers
,
buflens
);
free
(
wsdata
.
wsbuf0
);
/* free temporary ws header */
}
}
else
{
...
...
@@ -1259,7 +1264,7 @@ int WebSocket_upgrade( networkHandles *net )
goto
exit
;
}
if
(
rcv
>
0
&&
strncmp
(
read_buf
,
"HTTP/1.1"
,
8u
)
==
0
)
if
(
strncmp
(
read_buf
,
"HTTP/1.1"
,
8u
)
==
0
)
{
if
(
strncmp
(
&
read_buf
[
9
],
"101"
,
3u
)
!=
0
)
{
...
...
@@ -1269,7 +1274,7 @@ int WebSocket_upgrade( networkHandles *net )
}
}
if
(
rcv
>
0
&&
strncmp
(
read_buf
,
"HTTP/1.1 101"
,
12u
)
==
0
)
if
(
strncmp
(
read_buf
,
"HTTP/1.1 101"
,
12u
)
==
0
)
{
const
char
*
p
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录