FIX: token util keyurl definition move to above callback definition
This commit is contained in:
parent
0c48e205d7
commit
36565f0c50
|
@ -119,6 +119,10 @@ function Util:set_asap_require_room_claim(checkRoom)
|
||||||
self.requireRoomClaim = checkRoom;
|
self.requireRoomClaim = checkRoom;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function Util:clear_asap_cache()
|
||||||
|
self.cache = require"util.cache".new(cacheSize);
|
||||||
|
end
|
||||||
|
|
||||||
--- Returns the public key by keyID
|
--- Returns the public key by keyID
|
||||||
-- @param keyId the key ID to request
|
-- @param keyId the key ID to request
|
||||||
-- @return the public key (the content of requested resource) or nil
|
-- @return the public key (the content of requested resource) or nil
|
||||||
|
@ -130,6 +134,9 @@ function Util:get_public_key(keyId)
|
||||||
local code;
|
local code;
|
||||||
local timeout_occurred;
|
local timeout_occurred;
|
||||||
local wait, done = async.waiter();
|
local wait, done = async.waiter();
|
||||||
|
|
||||||
|
local keyurl = path.join(self.asapKeyServer, hex.to(sha256(keyId))..'.pem');
|
||||||
|
|
||||||
local function cb(content_, code_, response_, request_)
|
local function cb(content_, code_, response_, request_)
|
||||||
if timeout_occurred == nil then
|
if timeout_occurred == nil then
|
||||||
content, code = content_, code_;
|
content, code = content_, code_;
|
||||||
|
@ -144,6 +151,7 @@ function Util:get_public_key(keyId)
|
||||||
module:log("warn", "public key reply delivered after timeout from: %s",keyurl);
|
module:log("warn", "public key reply delivered after timeout from: %s",keyurl);
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- TODO: Is the done() call racey? Can we cancel this if the request
|
-- TODO: Is the done() call racey? Can we cancel this if the request
|
||||||
-- succeedes?
|
-- succeedes?
|
||||||
local function cancel()
|
local function cancel()
|
||||||
|
@ -159,7 +167,6 @@ function Util:get_public_key(keyId)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local keyurl = path.join(self.asapKeyServer, hex.to(sha256(keyId))..'.pem');
|
|
||||||
module:log("debug", "Fetching public key from: "..keyurl);
|
module:log("debug", "Fetching public key from: "..keyurl);
|
||||||
|
|
||||||
-- We hash the key ID to work around some legacy behavior and make
|
-- We hash the key ID to work around some legacy behavior and make
|
||||||
|
|
Loading…
Reference in New Issue