|
@@ -103,7 +103,15 @@ function get_public_key(keyId)
|
103
|
103
|
}, cb);
|
104
|
104
|
-- TODO: Is the done() call racey? Can we cancel this if the request
|
105
|
105
|
-- succeedes?
|
106
|
|
- timer.add_task(http_timeout, function() http.destroy_request(request); done(); end);
|
|
106
|
+ local function cancel()
|
|
107
|
+ -- TODO: This check is racey. Not likely to be a problem, but we should
|
|
108
|
+ -- still stick a mutex on content / code at some point.
|
|
109
|
+ if code == nil then
|
|
110
|
+ http.destroy_request(request);
|
|
111
|
+ done();
|
|
112
|
+ end
|
|
113
|
+ end
|
|
114
|
+ timer.add_task(http_timeout, cancel);
|
107
|
115
|
wait();
|
108
|
116
|
|
109
|
117
|
if code == 200 or code == 204 then
|