Thu, 23 Mar 2023 12:14:53 +0000
client: Fix timeout handling
Previously, the timeout handler would fire an error that would get caught and
logged by the timer code. However that error never reached the upper levels of
scansion, leading to the whole thing just hanging.
Now we just trigger resumption of the async runner, and throw the error from
there if we haven't received the stanza yet.
With this change, timeouts are now correctly handled and reported as failures.
local function filter_expression(script, s) local expr = s:match("^%$%{(.+)%}$"); if not expr then return s end local name, value_name = expr:match("^(.+)'s (.+)$"); assert(name, "Unable to parse expression: "..expr); local key = value_name:lower():gsub(" ", "_"); assert(script.objects[name], "Unknown object called "..name); local value = script.objects[name][key]; assert(value ~= nil, "Unknown attribute (of "..name.."): "..value_name); return value; end local function fill_vars(script, stanza) for k, v in pairs(stanza.attr) do stanza.attr[k] = filter_expression(script, v); end for i, child in ipairs(stanza) do if type(child) == "string" then stanza[i] = filter_expression(script, child); elseif type(child) == "table" then fill_vars(script, child); end end return stanza; end return { filter_expression = filter_expression; fill_vars = fill_vars; };