-
Notifications
You must be signed in to change notification settings - Fork 59
/
client_test.js
66 lines (53 loc) · 1.18 KB
/
client_test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
'use strict';
var rpc = require('./index.js');
var step = require('step');
var total = 0;
var intervalId;
var started = 0;
var finished = 0;
function next(){
if(total > 100){
clearInterval(intervalId);
console.log('end');
console.log('res', started, '->', finished);
return;
}
console.log('next', total);
total++;
step(
function(){
for(var p = 0; p < 100; ++p){
rpc.connect(6556, 'localhost', function(remote, conn){
started++;
remote.combine(1, 2, function(res){
if(res !== 3){
console.log('Achtung!!! ---------', res);
}
remote.getFile(function(ires){
var l = JSON.stringify(ires).length;
if(l !== 21){
console.log(l, 'TT_TT, Achtung');
}
finished++;
if(finished === started){
console.log('res', started, '->', finished);
}
conn.destroy();
conn.end();
});
});
});
}
});
}
intervalId = setInterval(next, 1000);
//rpc.connect(6556, 'localhost', function(remote, conn){
// remote.combine(1, 2, function(res){
// console.log(res)
// remote.getFile(function(res2){
// console.log(res2);
// conn.destroy();
// conn.end();
// });
// });
//});