test new rpc apis

This commit is contained in:
ansuz
2017-04-07 10:32:26 +02:00
parent 2a566671f2
commit 166e70f628

View File

@@ -36,11 +36,6 @@ define([
console.log(msg); console.log(msg);
}); });
} }
call.getFileListSize(list, function (e, bytes) {
if (e) { return void console.error(e); }
console.log("%s total bytes used", bytes);
});
call.getServerHash(function (e, hash) { call.getServerHash(function (e, hash) {
if (e) { return void console.error(e); } if (e) { return void console.error(e); }
console.log("the server believes your user hash is [%s]", hash); console.log("the server believes your user hash is [%s]", hash);
@@ -51,6 +46,11 @@ define([
var localHash = call.localChannelsHash(); var localHash = call.localChannelsHash();
var serverHash; var serverHash;
call.getFileListSize(function (e, bytes) {
if (e) { return void console.error(e); }
console.log("%s total bytes used", bytes);
});
call.getServerHash(function (e, hash) { call.getServerHash(function (e, hash) {
if (e) { return void console.error(e); } if (e) { return void console.error(e); }
serverHash = hash; serverHash = hash;
@@ -64,10 +64,21 @@ define([
var list = call.uniqueChannelList(); var list = call.uniqueChannelList();
var left = list.length;
// now start pinning... // now start pinning...
list.forEach(function (channel) { list.forEach(function (channel) {
call.pin(channel, function (e, out) { call.pin(channel, function (e, hash) {
if (e) { return console.error(e); } left--;
if (!e) {
console.log('pinned channel [%s]. new hash is [%s]', channel, hash);
} else {
console.error(e);
}
if (left === 0) {
console.log('done pinning');
}
}); });
}); });
}); });