Skip to content

Commit

Permalink
add interger version release, fix nodemcu#234, nodemcu#252, nodemcu#246
Browse files Browse the repository at this point in the history
  • Loading branch information
funshine committed Mar 11, 2015
1 parent 113db6f commit d28a2c9
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 9 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ script:
- cd bin/
- file_name_integer="nodemcu_integer_${TRAVIS_TAG}.bin"
- srec_cat -output ${file_name_integer} -binary 0x00000.bin -binary -fill 0xff 0x00000 0x10000 0x10000.bin -binary -offset 0x10000
- ls
deploy:
provider: releases
api_key:
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ Tencent QQ group: 309957875<br />
- cross compiler (done)

# Change log
2015-03-11<br />
fix bugs of spiffs.<br />
build both float and integer version [latest releases](https://github.com/nodemcu/nodemcu-firmware/releases/latest).<br />
fix tmr.time().<br />
fix memory leak when DNS fail.

2015-03-10<br />
update to the recent spiffs.<br />
add file.fsinfo() api, usage: remain, used, total = file.fsinfo().<br />
Expand Down
2 changes: 1 addition & 1 deletion app/include/user_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
#define NODE_VERSION_INTERNAL 0U

#define NODE_VERSION "NodeMCU 0.9.5"
#define BUILD_DATE "build 20150310"
#define BUILD_DATE "build 20150311"

#endif /* __USER_VERSION_H__ */
25 changes: 18 additions & 7 deletions app/modules/net.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,15 @@ static void net_dns_found(const char *name, ip_addr_t *ipaddr, void *arg)
return;
}

if(nud->self_ref == LUA_NOREF){
NODE_DBG("self_ref null.\n");
return;
}

if(ipaddr == NULL)
{
NODE_ERR( "DNS Fail!\n" );
return;
goto end;
}

// ipaddr->addr is a uint32_t ip
Expand All @@ -214,16 +219,12 @@ static void net_dns_found(const char *name, ip_addr_t *ipaddr, void *arg)
c_sprintf(ip_str, IPSTR, IP2STR(&(ipaddr->addr)));
}

if(nud->self_ref == LUA_NOREF){
NODE_DBG("self_ref null.\n");
return;
}

lua_rawgeti(gL, LUA_REGISTRYINDEX, nud->cb_dns_found_ref); // the callback function
lua_rawgeti(gL, LUA_REGISTRYINDEX, nud->self_ref); // pass the userdata(conn) to callback func in lua
lua_pushstring(gL, ip_str); // the ip para
lua_call(gL, 2, 0);

end:
if((pesp_conn->type == ESPCONN_TCP && pesp_conn->proto.tcp->remote_port == 0)
|| (pesp_conn->type == ESPCONN_UDP && pesp_conn->proto.udp->remote_port == 0) ){
lua_gc(gL, LUA_GCSTOP, 0);
Expand Down Expand Up @@ -597,12 +598,22 @@ static void socket_dns_found(const char *name, ip_addr_t *ipaddr, void *arg)
NODE_DBG("pesp_conn null.\n");
return;
}

lnet_userdata *nud = (lnet_userdata *)pesp_conn->reverse;
if(nud == NULL)
return;
if(gL == NULL)
return;
if(ipaddr == NULL)
{
dns_reconn_count++;
if( dns_reconn_count >= 5 ){
NODE_ERR( "DNS Fail!\n" );
lua_gc(gL, LUA_GCSTOP, 0);
if(nud->self_ref != LUA_NOREF){
luaL_unref(gL, LUA_REGISTRYINDEX, nud->self_ref);
nud->self_ref = LUA_NOREF; // unref this, and the net.socket userdata will delete it self
}
lua_gc(gL, LUA_GCRESTART, 0);
return;
}
NODE_ERR( "DNS retry %d!\n", dns_reconn_count );
Expand Down
8 changes: 8 additions & 0 deletions examples/fragment.lua
Original file line number Diff line number Diff line change
Expand Up @@ -370,3 +370,11 @@ for n,s in pairs(file.list()) do print(n.." size: "..s) end
file.remove("test1.txt")
for n,s in pairs(file.list()) do print(n.." size: "..s) end
file.open("test2.txt", "a+") for i = 1, 1*1000 do file.write("x") end file.close() print("Done.")


function TestDNSLeak()
c=net.createConnection(net.TCP, 0)
c:connect(80, "bad-name.tlddfdf")
tmr.alarm(1, 3000, 0, function() print("hack socket close, MEM: "..node.heap()) c:close() end) -- socket timeout hack
print("MEM: "..node.heap())
end

0 comments on commit d28a2c9

Please sign in to comment.