Skip to content

Commit

Permalink
[fix] actors: be careful about opa vs. js options.
Browse files Browse the repository at this point in the history
LocalChannel objects used to expect an Opa option, but the callback
conversion function returns a function.
  • Loading branch information
arthuraa committed Aug 24, 2012
1 parent 26be7ac commit e6adaeb
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
3 changes: 1 addition & 2 deletions lib/plugins/server/actor.js
Expand Up @@ -82,13 +82,12 @@ var LocalChannelStore = function(){
* @constructor
*/
function LocalChannel(st, unserialize, fun_session, ctx, dfun, more, concurrent) {
var tmp;
this.lchan_id = LocalChannelStore.random_id();
this.state = st;
this.action = fun_session;
this.unserialize = unserialize;
this.messages = new Array() ;
this.on_delete = (tmp = dfun.some)?[tmp]:[];
this.on_delete = dfun === null ? [] : [dfun];
this.more = more;
this.ctx = ctx;
this.concurrent = concurrent;
Expand Down
2 changes: 1 addition & 1 deletion lib/plugins/server/bslActor.js
Expand Up @@ -9,7 +9,7 @@
-> Actor.t('ctx, 'msg)}
*/
function make(state, handler, ondelete, ctx, concurrent) {
return new LocalChannel(state, null, handler, ctx, ondelete, null, concurrent);
return new LocalChannel(state, null, handler, ctx, option2js(ondelete), null, concurrent);
}

/**
Expand Down
5 changes: 4 additions & 1 deletion lib/plugins/server/bslActor.nodejs
Expand Up @@ -6,6 +6,7 @@
option('ctx), \
bool \
-> Actor.t('ctx, 'msg)}
* Prototype for the type checker.
*/
function make(state, handler, ondelete, ctx, concurrent) {
return new LocalChannel(state, null, h, ctx, d, null, concurrent);
Expand All @@ -23,7 +24,9 @@ function make(state, handler, ondelete, ctx, concurrent) {
*/
function make_cps(state, handler, ondelete, ctx, concurrent, k) {
var h = function(st, msg, ctx, fk){ handler(st, msg, ctx, cont(fk)) };
var d = opa_cps_callback_to_js_callback0(ondelete);
var d = option2js(ondelete);
// FIXME: There's one argument missing here
d = d ? opa_cps_callback_to_js_callback0(d) : null;
var a = new LocalChannel(state, null, h, ctx, d, null, concurrent);
return_(k, a);
}
Expand Down

0 comments on commit e6adaeb

Please sign in to comment.