Permalink
Browse files

some removal of state from derived classes

  • Loading branch information...
1 parent f2a58d5 commit 3a8bd4b627063c0c48c6a7ff01065ed3e56b373e @cloudshift committed Mar 19, 2012
Showing with 12 additions and 19 deletions.
  1. +6 −7 cloudshift/channel/ClientSinkImpl.hx
  2. +6 −12 cloudshift/channel/ServerSinkImpl.hx
View
13 cloudshift/channel/ClientSinkImpl.hx
@@ -6,32 +6,31 @@ import cloudshift.Session;
import cloudshift.Channel;
import cloudshift.channel.Flow;
+using cloudshift.Mixin;
class ClientSinkImpl extends SinkImpl {
- var _sessID:String;
-
- public function new(sess:String) {
+ public function new() {
super();
- _sessID = sess;
_myfill = myfill;
}
function
myfill(pkt:Pkt<Dynamic>,chan:String,?meta:Dynamic) {
- _conduit[0].pump(_sessID,pkt,chan,meta);
+ _conduit.pump("dummy",pkt,chan,meta);
+ //notify(Outgoing("dummy",pkt,chan,meta));
}
override function
removeChan<T>(pipe:Chan<T>) {
super.removeChan(pipe);
- reqUnsub(_sessID,pipe,function(cb) {
+ reqUnsub("dummy",pipe,function(cb) {
Core.info("ok unsubbed:"+pipe.pid());
});
}
override function
reqUnsub(sessId,pipe:Chan<Dynamic>,cb:Either<String,String>->Void) {
- _conduit[0].leave(pipe.pid()).deliver(cb);
+ _conduit.leave(pipe.pid()).deliver(cb);
}
}
View
18 cloudshift/channel/ServerSinkImpl.hx
@@ -11,11 +11,8 @@ using cloudshift.Mixin;
class ServerSinkImpl extends SinkImpl {
- var sessionMgr:SessionMgr;
-
- public function new(sessionMgr:SessionMgr) {
+ public function new() {
super();
- this.sessionMgr = sessionMgr;
_myfill = myfill;
}
@@ -26,11 +23,12 @@ class ServerSinkImpl extends SinkImpl {
switch(e) {
case Right(_):
var unsub = chan.sub(function(payload:Dynamic) {
- _conduit[0].pump(sessID,payload,pID,null);
+ _conduit.pump(sessID,payload,pID,null);
+ //notify(Outgoing(sessID,payload,pID,null));
});
trace("added sub "+pID+" for "+sessID);
- _conduit[0].subscriptions(sessID).set(pID,unsub);
+ _conduit.subscriptions(sessID).set(pID,unsub);
cb(e);
case Left(_):
cb(e);
@@ -40,7 +38,7 @@ class ServerSinkImpl extends SinkImpl {
override function
reqUnsub(sessID:String,chan:Chan<Dynamic>,cb:Either<String,String>->Void) {
- switch(_conduit[0].subscriptions(sessID).getOption(chan.pid())) {
+ switch(_conduit.subscriptions(sessID).getOption(chan.pid())) {
case Some(f):
trace("remove function for "+chan.pid());
f();
@@ -50,13 +48,9 @@ class ServerSinkImpl extends SinkImpl {
}
}
- public function mys():SessionMgr {
- return sessionMgr;
- }
-
override function
removeAllSubs(sessID) {
- var subs = _conduit[0].subscriptions(sessID) ;
+ var subs = _conduit.subscriptions(sessID) ;
if (subs != null)
subs.values().foreach(function(f) f());
}

0 comments on commit 3a8bd4b

Please sign in to comment.