mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-20 12:15:51 +00:00
Merge branch 'develop' of https://github.com/ripple/ripple-lib into develop
This commit is contained in:
@@ -61,7 +61,7 @@ function Account(remote, account) {
|
||||
this.on('removeListener', listener_removed);
|
||||
|
||||
function prepare_subscribe(request) {
|
||||
if (self._subs) {
|
||||
if (self._account.is_valid() && self._subs) {
|
||||
request.accounts(self._account_id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,12 +48,15 @@ PathFind.prototype.create = function ()
|
||||
|
||||
function handleInitialPath(err, msg) {
|
||||
if (err) {
|
||||
// XXX Handle error
|
||||
self.emit('error', err);
|
||||
return;
|
||||
}
|
||||
self.notify_update(msg);
|
||||
}
|
||||
|
||||
// XXX We should add ourselves to prepare_subscribe or a similar mechanism so
|
||||
// that we can resubscribe after a reconnection.
|
||||
|
||||
req.request();
|
||||
};
|
||||
|
||||
@@ -81,6 +84,9 @@ PathFind.prototype.notify_update = function (message)
|
||||
|
||||
PathFind.prototype.notify_superceded = function ()
|
||||
{
|
||||
// XXX If we're set to re-subscribe whenever we connect to a new server, then
|
||||
// we should cancel that behavior here. See PathFind#create.
|
||||
|
||||
this.emit('end');
|
||||
this.emit('superceded');
|
||||
};
|
||||
|
||||
@@ -963,6 +963,11 @@ Remote.prototype._server_prepare_subscribe = function (callback) {
|
||||
self.emit('subscribed');
|
||||
});
|
||||
|
||||
request.on('error', function (err) {
|
||||
// XXX We need a better global error handling
|
||||
console.log(err);
|
||||
});
|
||||
|
||||
self.emit('prepare_subscribe', request);
|
||||
|
||||
request.callback(callback);
|
||||
|
||||
@@ -374,6 +374,9 @@ var STVL = exports.VariableLength = new SerializedType({
|
||||
var STAccount = exports.Account = new SerializedType({
|
||||
serialize: function (so, val) {
|
||||
var account = UInt160.from_json(val);
|
||||
if (!account.is_valid()) {
|
||||
throw new Error("Invalid account!");
|
||||
}
|
||||
serialize_hex(so, account.to_hex());
|
||||
},
|
||||
parse: function (so) {
|
||||
|
||||
Reference in New Issue
Block a user