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
ebdea502
Commit
ebdea502
authored
Feb 20, 2015
by
Ian Craggs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Better fix for 459791
Bug: 459791
parent
503ae24d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
13 deletions
+18
-13
MQTTClient.c
src/MQTTClient.c
+18
-13
No files found.
src/MQTTClient.c
View file @
ebdea502
...
...
@@ -930,11 +930,7 @@ exit:
}
}
else
{
Thread_unlock_mutex
(
mqttclient_mutex
);
MQTTClient_disconnect1
(
handle
,
0
,
0
,
(
MQTTVersion
==
3
));
/* not "internal" because we don't want to call connection lost */
Thread_lock_mutex
(
mqttclient_mutex
);
}
MQTTClient_disconnect1
(
handle
,
0
,
0
,
(
MQTTVersion
==
3
));
/* don't want to call connection lost */
FUNC_EXIT_RC
(
rc
);
return
rc
;
}
...
...
@@ -1115,7 +1111,10 @@ exit:
}
int
MQTTClient_disconnect1
(
MQTTClient
handle
,
int
timeout
,
int
internal
,
int
stop
)
/**
* mqttclient_mutex must be locked when you call this function, if multi threaded
*/
int
MQTTClient_disconnect1
(
MQTTClient
handle
,
int
timeout
,
int
call_connection_lost
,
int
stop
)
{
MQTTClients
*
m
=
handle
;
START_TIME_TYPE
start
;
...
...
@@ -1123,9 +1122,6 @@ int MQTTClient_disconnect1(MQTTClient handle, int timeout, int internal, int sto
int
was_connected
=
0
;
FUNC_ENTRY
;
if
(
!
internal
)
Thread_lock_mutex
(
mqttclient_mutex
);
if
(
m
==
NULL
||
m
->
c
==
NULL
)
{
rc
=
MQTTCLIENT_FAILURE
;
...
...
@@ -1164,24 +1160,28 @@ int MQTTClient_disconnect1(MQTTClient handle, int timeout, int internal, int sto
exit:
if
(
stop
)
MQTTClient_stop
();
if
(
internal
&&
m
->
cl
&&
was_connected
)
if
(
call_connection_lost
&&
m
->
cl
&&
was_connected
)
{
Log
(
TRACE_MIN
,
-
1
,
"Calling connectionLost for client %s"
,
m
->
c
->
clientID
);
Thread_start
(
connectionLost_call
,
m
);
}
if
(
!
internal
)
Thread_unlock_mutex
(
mqttclient_mutex
);
FUNC_EXIT_RC
(
rc
);
return
rc
;
}
/**
* mqttclient_mutex must be locked when you call this function, if multi threaded
*/
int
MQTTClient_disconnect_internal
(
MQTTClient
handle
,
int
timeout
)
{
return
MQTTClient_disconnect1
(
handle
,
timeout
,
1
,
1
);
}
/**
* mqttclient_mutex must be locked when you call this function, if multi threaded
*/
void
MQTTProtocol_closeSession
(
Clients
*
c
,
int
sendwill
)
{
MQTTClient_disconnect_internal
((
MQTTClient
)
c
->
context
,
0
);
...
...
@@ -1190,7 +1190,12 @@ void MQTTProtocol_closeSession(Clients* c, int sendwill)
int
MQTTClient_disconnect
(
MQTTClient
handle
,
int
timeout
)
{
return
MQTTClient_disconnect1
(
handle
,
timeout
,
0
,
1
);
int
rc
=
0
;
Thread_lock_mutex
(
mqttclient_mutex
);
rc
=
MQTTClient_disconnect1
(
handle
,
timeout
,
0
,
1
);
Thread_unlock_mutex
(
mqttclient_mutex
);
return
rc
;
}
...
...
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