rpc: implement more methods.
This commit is contained in:
parent
666ff94ddf
commit
104458a483
File diff suppressed because it is too large
Load Diff
@ -309,7 +309,10 @@ HTTPServer.prototype._init = function _init() {
|
||||
res.setHeader('WWW-Authenticate', 'Basic realm="rpc"');
|
||||
send(401, {
|
||||
result: null,
|
||||
error: 'Bad auth.',
|
||||
error: {
|
||||
message: 'Bad auth.',
|
||||
code: 1
|
||||
},
|
||||
id: req.body.id
|
||||
});
|
||||
return;
|
||||
@ -326,7 +329,10 @@ HTTPServer.prototype._init = function _init() {
|
||||
self.logger.error(err);
|
||||
return send(400, {
|
||||
result: null,
|
||||
error: err.message,
|
||||
error: {
|
||||
message: err.message,
|
||||
code: 1
|
||||
},
|
||||
id: req.body.id
|
||||
});
|
||||
}
|
||||
|
||||
@ -797,6 +797,13 @@ utils.inspectify = function inspectify(obj, color) {
|
||||
: obj;
|
||||
};
|
||||
|
||||
/**
|
||||
* Format a string.
|
||||
* @function
|
||||
*/
|
||||
|
||||
utils.fmt = util.format;
|
||||
|
||||
/**
|
||||
* Format a string.
|
||||
* @param {Array} args
|
||||
|
||||
@ -2481,6 +2481,7 @@ function MasterKey(options) {
|
||||
this.key = null;
|
||||
|
||||
this.timer = null;
|
||||
this.until = 0;
|
||||
this._destroy = this.destroy.bind(this);
|
||||
this.locker = new bcoin.locker(this);
|
||||
}
|
||||
@ -2585,6 +2586,7 @@ MasterKey.prototype.start = function start(timeout) {
|
||||
if (timeout === -1)
|
||||
return;
|
||||
|
||||
this.until = utils.now() + (timeout / 1000 | 0);
|
||||
this.timer = setTimeout(this._destroy, timeout);
|
||||
};
|
||||
|
||||
@ -2597,6 +2599,7 @@ MasterKey.prototype.stop = function stop() {
|
||||
if (this.timer != null) {
|
||||
clearTimeout(this.timer);
|
||||
this.timer = null;
|
||||
this.until = 0;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user