fix #185
This commit is contained in:
parent
7f970df70b
commit
dec47d5372
|
@ -725,8 +725,15 @@ static int mqtt_socket_connect( lua_State* L )
|
|||
if(mud == NULL)
|
||||
return 0;
|
||||
|
||||
if(mud->pesp_conn)
|
||||
if(mud->pesp_conn){ //TODO: should I free tcp struct directly or ask user to call close()???
|
||||
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;
|
||||
pesp_conn = mud->pesp_conn = (struct espconn *)c_zalloc(sizeof(struct espconn));
|
||||
if(!pesp_conn)
|
||||
|
|
|
@ -665,6 +665,10 @@ static int net_start( lua_State* L, const char* mt )
|
|||
return 0;
|
||||
}
|
||||
|
||||
if(nud->pesp_conn == NULL){
|
||||
NODE_DBG("nud->pesp_conn is NULL.\n");
|
||||
return 0;
|
||||
}
|
||||
pesp_conn = nud->pesp_conn;
|
||||
port = luaL_checkinteger( L, stack );
|
||||
stack++;
|
||||
|
@ -1074,6 +1078,10 @@ static int net_dns( lua_State* L, const char* mt )
|
|||
return 0;
|
||||
}
|
||||
|
||||
if(nud->pesp_conn == NULL){
|
||||
NODE_DBG("nud->pesp_conn is NULL.\n");
|
||||
return 0;
|
||||
}
|
||||
pesp_conn = nud->pesp_conn;
|
||||
|
||||
if(!isserver || pesp_conn->type == ESPCONN_UDP){ // self_ref is only needed by socket userdata, or udp server
|
||||
|
|
Loading…
Reference in New Issue