Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
Nodemcu Firmware
Commits
cfae4cdc
Commit
cfae4cdc
authored
Nov 10, 2015
by
Johny Mattsson
Browse files
Merge pull request #735 from karrots/mqtt_close_disconnect
mqtt:close() send the DISCONNECT message (fix #673)
parents
5d036c46
b2167bdf
Changes
1
Hide whitespace changes
Inline
Side-by-side
app/modules/mqtt.c
View file @
cfae4cdc
...
@@ -1034,7 +1034,14 @@ static int mqtt_socket_close( lua_State* L )
...
@@ -1034,7 +1034,14 @@ static int mqtt_socket_close( lua_State* L )
if
(
mud
->
pesp_conn
==
NULL
)
if
(
mud
->
pesp_conn
==
NULL
)
return
0
;
return
0
;
// call mqtt_disconnect()
// Send disconnect message
mqtt_message_t
*
temp_msg
=
mqtt_msg_disconnect
(
&
mud
->
mqtt_state
.
mqtt_connection
);
NODE_DBG
(
"Send MQTT disconnect infomation, data len: %d, d[0]=%d
\r\n
"
,
temp_msg
->
length
,
temp_msg
->
data
[
0
]);
if
(
mud
->
secure
)
espconn_secure_sent
(
mud
->
pesp_conn
,
temp_msg
->
data
,
temp_msg
->
length
);
else
espconn_sent
(
mud
->
pesp_conn
,
temp_msg
->
data
,
temp_msg
->
length
);
mud
->
mqtt_state
.
auto_reconnect
=
0
;
// stop auto reconnect.
mud
->
mqtt_state
.
auto_reconnect
=
0
;
// stop auto reconnect.
#ifdef CLIENT_SSL_ENABLE
#ifdef CLIENT_SSL_ENABLE
...
...
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