Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
paho.mqtt.c
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
eclipse
paho.mqtt.c
Commits
43dfcb2f
Commit
43dfcb2f
authored
May 04, 2018
by
Ian Craggs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean state when sessionPresent flag is 0
parent
77cc4fb9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
4 deletions
+8
-4
MQTTAsync.c
src/MQTTAsync.c
+8
-4
No files found.
src/MQTTAsync.c
View file @
43dfcb2f
...
@@ -379,7 +379,7 @@ static void MQTTAsync_checkTimeouts(void);
...
@@ -379,7 +379,7 @@ static void MQTTAsync_checkTimeouts(void);
static
thread_return_type
WINAPI
MQTTAsync_sendThread
(
void
*
n
);
static
thread_return_type
WINAPI
MQTTAsync_sendThread
(
void
*
n
);
static
void
MQTTAsync_emptyMessageQueue
(
Clients
*
client
);
static
void
MQTTAsync_emptyMessageQueue
(
Clients
*
client
);
static
void
MQTTAsync_removeResponsesAndCommands
(
MQTTAsyncs
*
m
);
static
void
MQTTAsync_removeResponsesAndCommands
(
MQTTAsyncs
*
m
);
static
int
MQTTAsync_completeConnection
(
MQTTAsyncs
*
m
,
MQTTPacket
*
p
ack
);
static
int
MQTTAsync_completeConnection
(
MQTTAsyncs
*
m
,
Connack
*
conn
ack
);
static
thread_return_type
WINAPI
MQTTAsync_receiveThread
(
void
*
n
);
static
thread_return_type
WINAPI
MQTTAsync_receiveThread
(
void
*
n
);
static
void
MQTTAsync_stop
(
void
);
static
void
MQTTAsync_stop
(
void
);
static
void
MQTTAsync_closeOnly
(
Clients
*
client
,
enum
MQTTReasonCodes
reasonCode
,
MQTTProperties
*
props
);
static
void
MQTTAsync_closeOnly
(
Clients
*
client
,
enum
MQTTReasonCodes
reasonCode
,
MQTTProperties
*
props
);
...
@@ -1898,14 +1898,13 @@ void MQTTAsync_free(void* memory)
...
@@ -1898,14 +1898,13 @@ void MQTTAsync_free(void* memory)
}
}
static
int
MQTTAsync_completeConnection
(
MQTTAsyncs
*
m
,
MQTTPacket
*
p
ack
)
static
int
MQTTAsync_completeConnection
(
MQTTAsyncs
*
m
,
Connack
*
conn
ack
)
{
{
int
rc
=
MQTTASYNC_FAILURE
;
int
rc
=
MQTTASYNC_FAILURE
;
FUNC_ENTRY
;
FUNC_ENTRY
;
if
(
m
->
c
->
connect_state
==
3
)
/* MQTT connect sent - wait for CONNACK */
if
(
m
->
c
->
connect_state
==
3
)
/* MQTT connect sent - wait for CONNACK */
{
{
Connack
*
connack
=
(
Connack
*
)
pack
;
Log
(
LOG_PROTOCOL
,
1
,
NULL
,
m
->
c
->
net
.
socket
,
m
->
c
->
clientID
,
connack
->
rc
);
Log
(
LOG_PROTOCOL
,
1
,
NULL
,
m
->
c
->
net
.
socket
,
m
->
c
->
clientID
,
connack
->
rc
);
if
((
rc
=
connack
->
rc
)
==
MQTTASYNC_SUCCESS
)
if
((
rc
=
connack
->
rc
)
==
MQTTASYNC_SUCCESS
)
{
{
...
@@ -1915,6 +1914,11 @@ static int MQTTAsync_completeConnection(MQTTAsyncs* m, MQTTPacket* pack)
...
@@ -1915,6 +1914,11 @@ static int MQTTAsync_completeConnection(MQTTAsyncs* m, MQTTPacket* pack)
m
->
c
->
connect_state
=
0
;
m
->
c
->
connect_state
=
0
;
if
(
m
->
c
->
cleansession
||
m
->
c
->
cleanstart
)
if
(
m
->
c
->
cleansession
||
m
->
c
->
cleanstart
)
rc
=
MQTTAsync_cleanSession
(
m
->
c
);
rc
=
MQTTAsync_cleanSession
(
m
->
c
);
else
if
(
m
->
c
->
MQTTVersion
>=
MQTTVERSION_3_1_1
&&
connack
->
flags
.
bits
.
sessionPresent
==
0
)
{
Log
(
LOG_PROTOCOL
,
-
1
,
"Cleaning session state on connect because sessionPresent is 0"
);
rc
=
MQTTAsync_cleanSession
(
m
->
c
);
}
if
(
m
->
c
->
outboundMsgs
->
count
>
0
)
if
(
m
->
c
->
outboundMsgs
->
count
>
0
)
{
{
ListElement
*
outcurrent
=
NULL
;
ListElement
*
outcurrent
=
NULL
;
...
@@ -2028,7 +2032,7 @@ static thread_return_type WINAPI MQTTAsync_receiveThread(void* n)
...
@@ -2028,7 +2032,7 @@ static thread_return_type WINAPI MQTTAsync_receiveThread(void* n)
{
{
Connack
*
connack
=
(
Connack
*
)
pack
;
Connack
*
connack
=
(
Connack
*
)
pack
;
int
sessionPresent
=
connack
->
flags
.
bits
.
sessionPresent
;
int
sessionPresent
=
connack
->
flags
.
bits
.
sessionPresent
;
int
rc
=
MQTTAsync_completeConnection
(
m
,
p
ack
);
int
rc
=
MQTTAsync_completeConnection
(
m
,
conn
ack
);
if
(
rc
==
MQTTASYNC_SUCCESS
)
if
(
rc
==
MQTTASYNC_SUCCESS
)
{
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment