Skip to content

Commit bccaab3

Browse files
committed
Change CloudI API parameter name pid to source.
1 parent d8923e6 commit bccaab3

File tree

1 file changed

+31
-27
lines changed

1 file changed

+31
-27
lines changed

CloudI.js

Lines changed: 31 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -424,16 +424,17 @@ CloudI.API.prototype.mcast_async = function (name, request, callback,
424424

425425
CloudI.API.prototype.forward_ = function (request_type, name,
426426
request_info, request,
427-
timeout, priority, trans_id, pid) {
427+
timeout, priority,
428+
trans_id, source) {
428429
var API = this;
429430
switch (request_type) {
430431
case API.ASYNC:
431432
API.forward_async(name, request_info, request,
432-
timeout, priority, trans_id, pid);
433+
timeout, priority, trans_id, source);
433434
return;
434435
case API.SYNC:
435436
API.forward_sync(name, request_info, request,
436-
timeout, priority, trans_id, pid);
437+
timeout, priority, trans_id, source);
437438
return;
438439
default:
439440
throw new InvalidInputException();
@@ -442,42 +443,42 @@ CloudI.API.prototype.forward_ = function (request_type, name,
442443

443444
CloudI.API.prototype.forward_async = function (name, request_info, request,
444445
timeout, priority,
445-
trans_id, pid) {
446+
trans_id, source) {
446447
this._poll_wait(function (API) {
447448
API._send([new Erlang.OtpErlangAtom('forward_async'), name,
448449
new Erlang.OtpErlangBinary(request_info),
449450
new Erlang.OtpErlangBinary(request),
450451
timeout, priority,
451-
new Erlang.OtpErlangBinary(trans_id), pid]);
452+
new Erlang.OtpErlangBinary(trans_id), source]);
452453
throw new ForwardAsyncException();
453454
});
454455
};
455456

456457
CloudI.API.prototype.forward_sync = function (name, request_info, request,
457458
timeout, priority,
458-
trans_id, pid) {
459+
trans_id, source) {
459460
this._poll_wait(function (API) {
460461
API._send([new Erlang.OtpErlangAtom('forward_sync'), name,
461462
new Erlang.OtpErlangBinary(request_info),
462463
new Erlang.OtpErlangBinary(request),
463464
timeout, priority,
464-
new Erlang.OtpErlangBinary(trans_id), pid]);
465+
new Erlang.OtpErlangBinary(trans_id), source]);
465466
throw new ForwardSyncException();
466467
});
467468
};
468469

469470
CloudI.API.prototype.return_ = function (request_type, name, pattern,
470471
response_info, response,
471-
timeout, trans_id, pid) {
472+
timeout, trans_id, source) {
472473
var API = this;
473474
switch (request_type) {
474475
case API.ASYNC:
475476
API.return_async(name, pattern, response_info, response,
476-
timeout, trans_id, pid);
477+
timeout, trans_id, source);
477478
return;
478479
case API.SYNC:
479480
API.return_sync(name, pattern, response_info, response,
480-
timeout, trans_id, pid);
481+
timeout, trans_id, source);
481482
return;
482483
default:
483484
throw new InvalidInputException();
@@ -486,24 +487,24 @@ CloudI.API.prototype.return_ = function (request_type, name, pattern,
486487

487488
CloudI.API.prototype.return_async = function (name, pattern,
488489
response_info, response,
489-
timeout, trans_id, pid) {
490+
timeout, trans_id, source) {
490491
this._poll_wait(function (API) {
491492
API._send([new Erlang.OtpErlangAtom('return_async'), name, pattern,
492493
new Erlang.OtpErlangBinary(response_info),
493494
new Erlang.OtpErlangBinary(response),
494-
timeout, new Erlang.OtpErlangBinary(trans_id), pid]);
495+
timeout, new Erlang.OtpErlangBinary(trans_id), source]);
495496
throw new ReturnAsyncException();
496497
});
497498
};
498499

499500
CloudI.API.prototype.return_sync = function (name, pattern,
500501
response_info, response,
501-
timeout, trans_id, pid) {
502+
timeout, trans_id, source) {
502503
this._poll_wait(function (API) {
503504
API._send([new Erlang.OtpErlangAtom('return_sync'), name, pattern,
504505
new Erlang.OtpErlangBinary(response_info),
505506
new Erlang.OtpErlangBinary(response),
506-
timeout, new Erlang.OtpErlangBinary(trans_id), pid]);
507+
timeout, new Erlang.OtpErlangBinary(trans_id), source]);
507508
throw new ReturnSyncException();
508509
});
509510
};
@@ -569,13 +570,14 @@ CloudI.API.prototype.priority_default = function () {
569570
CloudI.API.prototype._null_response = function (request_type, name, pattern,
570571
request_info, request,
571572
timeout, priority,
572-
trans_id, pid) {
573+
trans_id, source) {
573574
return '';
574575
};
575576

576577
CloudI.API.prototype._callback = function (command, name, pattern,
577578
request_info, request,
578-
timeout, priority, trans_id, pid) {
579+
timeout, priority,
580+
trans_id, source) {
579581
var API = this;
580582
var function_queue = API._callbacks[pattern];
581583
var f;
@@ -632,7 +634,7 @@ CloudI.API.prototype._callback = function (command, name, pattern,
632634
try {
633635
API.return_async(name, pattern,
634636
response_info, response,
635-
timeout, trans_id, pid);
637+
timeout, trans_id, source);
636638
}
637639
catch (err_new) {
638640
err_new = undefined;
@@ -647,7 +649,8 @@ CloudI.API.prototype._callback = function (command, name, pattern,
647649
var response = f.obj_f.call(f.obj,
648650
API.ASYNC, name, pattern,
649651
request_info, request,
650-
timeout, priority, trans_id, pid);
652+
timeout, priority,
653+
trans_id, source);
651654
if (typeof response === 'undefined') {
652655
return;
653656
}
@@ -670,7 +673,7 @@ CloudI.API.prototype._callback = function (command, name, pattern,
670673
try {
671674
API.return_async(name, pattern,
672675
response_info, response,
673-
timeout, trans_id, pid);
676+
timeout, trans_id, source);
674677
}
675678
catch (err_new) {
676679
err_new = undefined;
@@ -722,7 +725,7 @@ CloudI.API.prototype._callback = function (command, name, pattern,
722725
try {
723726
API.return_sync(name, pattern,
724727
response_info, response,
725-
timeout, trans_id, pid);
728+
timeout, trans_id, source);
726729
}
727730
catch (err_new) {
728731
err_new = undefined;
@@ -737,7 +740,8 @@ CloudI.API.prototype._callback = function (command, name, pattern,
737740
var response = f.obj_f.call(f.obj,
738741
API.SYNC, name, pattern,
739742
request_info, request,
740-
timeout, priority, trans_id, pid);
743+
timeout, priority,
744+
trans_id, source);
741745
if (typeof response === 'undefined') {
742746
return;
743747
}
@@ -760,7 +764,7 @@ CloudI.API.prototype._callback = function (command, name, pattern,
760764
try {
761765
API.return_sync(name, pattern,
762766
response_info, response,
763-
timeout, trans_id, pid);
767+
timeout, trans_id, source);
764768
}
765769
catch (err_new) {
766770
err_new = undefined;
@@ -887,15 +891,15 @@ CloudI.API.prototype._poll_request = function (data) {
887891
j = i + 16;
888892
var trans_id = data.slice(i, j);
889893
i = j;
890-
var pid_size = unpackUint32(i, data);
894+
var source_size = unpackUint32(i, data);
891895
i += 4;
892-
j = i + pid_size;
893-
var pid = data.slice(i, j);
896+
j = i + source_size;
897+
var source = data.slice(i, j);
894898
i = j;
895899
if (i != data_size) {
896900
API._handle_events(data, data_size, i);
897901
}
898-
Erlang.binary_to_term(pid, function (err, pid_object) {
902+
Erlang.binary_to_term(source, function (err, source_object) {
899903
if (err) {
900904
API._exception(err);
901905
API._poll_terminate();
@@ -904,7 +908,7 @@ CloudI.API.prototype._poll_request = function (data) {
904908
API._callback(command, name, pattern,
905909
request_info, request,
906910
request_timeout, priority,
907-
trans_id, pid_object);
911+
trans_id, source_object);
908912
}
909913
});
910914
return;

0 commit comments

Comments
 (0)