Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Nodemcu Firmware
Commits
dec47d53
Commit
dec47d53
authored
Feb 07, 2015
by
funshine
Browse files
fix #185
parent
7f970df7
Changes
2
Hide whitespace changes
Inline
Side-by-side
app/modules/mqtt.c
View file @
dec47d53
...
@@ -725,8 +725,15 @@ static int mqtt_socket_connect( lua_State* L )
...
@@ -725,8 +725,15 @@ static int mqtt_socket_connect( lua_State* L )
if
(
mud
==
NULL
)
if
(
mud
==
NULL
)
return
0
;
return
0
;
if
(
mud
->
pesp_conn
)
if
(
mud
->
pesp_conn
){
//TODO: should I free tcp struct directly or ask user to call close()???
c_free
(
mud
->
pesp_conn
);
mud
->
pesp_conn
->
reverse
=
NULL
;
if
(
mud
->
pesp_conn
->
proto
.
tcp
)
c_free
(
mud
->
pesp_conn
->
proto
.
tcp
);
mud
->
pesp_conn
->
proto
.
tcp
=
NULL
;
c_free
(
mud
->
pesp_conn
);
mud
->
pesp_conn
=
NULL
;
}
struct
espconn
*
pesp_conn
=
NULL
;
struct
espconn
*
pesp_conn
=
NULL
;
pesp_conn
=
mud
->
pesp_conn
=
(
struct
espconn
*
)
c_zalloc
(
sizeof
(
struct
espconn
));
pesp_conn
=
mud
->
pesp_conn
=
(
struct
espconn
*
)
c_zalloc
(
sizeof
(
struct
espconn
));
if
(
!
pesp_conn
)
if
(
!
pesp_conn
)
...
...
app/modules/net.c
View file @
dec47d53
...
@@ -665,6 +665,10 @@ static int net_start( lua_State* L, const char* mt )
...
@@ -665,6 +665,10 @@ static int net_start( lua_State* L, const char* mt )
return
0
;
return
0
;
}
}
if
(
nud
->
pesp_conn
==
NULL
){
NODE_DBG
(
"nud->pesp_conn is NULL.
\n
"
);
return
0
;
}
pesp_conn
=
nud
->
pesp_conn
;
pesp_conn
=
nud
->
pesp_conn
;
port
=
luaL_checkinteger
(
L
,
stack
);
port
=
luaL_checkinteger
(
L
,
stack
);
stack
++
;
stack
++
;
...
@@ -1074,6 +1078,10 @@ static int net_dns( lua_State* L, const char* mt )
...
@@ -1074,6 +1078,10 @@ static int net_dns( lua_State* L, const char* mt )
return
0
;
return
0
;
}
}
if
(
nud
->
pesp_conn
==
NULL
){
NODE_DBG
(
"nud->pesp_conn is NULL.
\n
"
);
return
0
;
}
pesp_conn
=
nud
->
pesp_conn
;
pesp_conn
=
nud
->
pesp_conn
;
if
(
!
isserver
||
pesp_conn
->
type
==
ESPCONN_UDP
){
// self_ref is only needed by socket userdata, or udp server
if
(
!
isserver
||
pesp_conn
->
type
==
ESPCONN_UDP
){
// self_ref is only needed by socket userdata, or udp server
...
...
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