Permalink
Browse files

[fix] actors: be careful about opa vs. js options.

LocalChannel objects used to expect an Opa option, but the callback
conversion function returns a function.
  • Loading branch information...
1 parent 26be7ac commit e6adaebcb90cfd09ae8c3b4709452c097bee7bbb @arthuraa arthuraa committed Aug 22, 2012
Showing with 6 additions and 4 deletions.
  1. +1 −2 lib/plugins/server/actor.js
  2. +1 −1 lib/plugins/server/bslActor.js
  3. +4 −1 lib/plugins/server/bslActor.nodejs
View
3 lib/plugins/server/actor.js
@@ -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;
View
2 lib/plugins/server/bslActor.js
@@ -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);
}
/**
View
5 lib/plugins/server/bslActor.nodejs
@@ -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);
@@ -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);
}

0 comments on commit e6adaeb

Please sign in to comment.