Skip to content

Commit

Permalink
utlis.lua增加readStream方法,支持任意位置读取指定长度的字符串,clib.lua增加发送完成回调参数uid,httpv2…
Browse files Browse the repository at this point in the history
…增强读取body的健壮性
  • Loading branch information
zhangtao committed Nov 16, 2018
1 parent ac15f9c commit 593b5e5
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 6 deletions.
2 changes: 1 addition & 1 deletion script_LuaTask/lib/clib.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ end)

rtos.on(rtos.MSG_UART_TX_DONE, function(id)
if uartSentCallbacks[id] then
uartSentCallbacks[id]()
uartSentCallbacks[id](id)
end
end)
2 changes: 1 addition & 1 deletion script_LuaTask/lib/sys.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ require "patch"
module(..., package.seeall)

-- lib脚本版本号,只要lib中的任何一个脚本做了修改,都需要更新此版本号
SCRIPT_LIB_VER = "2.1.8"
SCRIPT_LIB_VER = "2.1.9"

-- TaskID最大值
local TASK_TIMER_ID_MAX = 0x1FFFFFFF
Expand Down
17 changes: 17 additions & 0 deletions script_LuaTask/lib/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -196,3 +196,20 @@ function io.fileSize(path)
end
return size
end

--- 返回指定位置读取的字符串
-- @string path,文件路径全名例如:"/ldata/call.txt"
-- @number offset,要读取的指定位置
-- @number len,要读取的字节数
-- @return string,返回要读取的数据,读取失败返回nil
function io.readStream(path, offset, len)
local file, str = io.open(path, "r")
if file then
local current = file:seek()
file:seek("set", offset)
str = file:read(len)
file:seek("set", current)
io.close(file)
end
return str
end
10 changes: 6 additions & 4 deletions script_LuaTask/release notes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
【问题出现概率】:必现
【问题出现原因】:path中出现“:数字”的格式,被解析成了端口
【问题解决方式】:优化解析正则表达式

(2)utlis.lua : 增加读取文件指定位置字符串的方法
(3)httpv2.lua: 增强读取body的健壮性
(4)clib.lua:发送完成回调增加uid参数


发布时间:2018/11/05 11:27
Expand Down Expand Up @@ -78,11 +80,11 @@
(3)socket.lua、link.lua、ril.lua:新增免费的腾讯云httpDns域名解析功能、新增socket.setDnsParser接口功能
【新功能重要性】:一般
【问题影响模块】:Air202、Air800、Air801、Air201、Air208
【新功能说明】:可设置用户自定义的DNS解析器,通过域名连接服务器时,DNS解析的过程如下:
【新功能说明】:可设置用户自定义的DNS解析器,通过域名连接服务器时,DNS解析的过程如下:

1、使用core中提供的方式,连接运营商DNS服务器解析,如果解析成功,则结束;如果解析失败,走第2步
1、使用core中提供的方式,连接运营商DNS服务器解析,如果解析成功,则结束;如果解析失败,走第2步

2、使用脚本lib中提供的免费腾讯云HttpDns解析,如果解析成功,则结束;如果解析失败,走第3步
2、使用脚本lib中提供的免费腾讯云HttpDns解析,如果解析成功,则结束;如果解析失败,走第3步

3、如果存在用户自定义的DNS解析器,则使用此处用户自定义的DNS解析器去解析
(4)net.lua:修正“小区信号强度小于10时,getCellInfo、getCellInfoExt、getMultiCell接口无法返回此小区信息”的问题
Expand Down

0 comments on commit 593b5e5

Please sign in to comment.