Skip to content

Commit

Permalink
Revert "Subscription Stubs: Store subscription node stubs in the node…
Browse files Browse the repository at this point in the history
… provider to solve subscribe-before-ready bug."

This reverts commit 760c876.
  • Loading branch information
azenla committed Jan 19, 2016
1 parent be24926 commit e89dd5d
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions lib/src/responder/responder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,11 @@ class Responder extends ConnectionHandler {
updateInvoke(m);
return;
} else {
if (method == 'close') {
if (_responses.containsKey(m['rid'])) {
if (_responses.containsKey(m['rid'])) {
if (method == 'close') {
close(m);
}
// when rid is invalid, nothing needs to be sent back
return;
}

Expand Down Expand Up @@ -178,7 +179,7 @@ class Responder extends ConnectionHandler {

_getNode(path, (LocalNode node) {
addResponse(new ListResponse(this, rid, node));
}, false, (e, stack) {
}, (e, stack) {
var error = new DSError(
"nodeError",
msg: e.toString(),
Expand All @@ -203,13 +204,11 @@ class Responder extends ConnectionHandler {
} else {
continue;
}

if (p['sid'] is int) {
sid = p['sid'];
} else {
continue;
}

if (p['qos'] is int) {
qos = p['qos'];
}
Expand All @@ -220,7 +219,7 @@ class Responder extends ConnectionHandler {
_getNode(path, (LocalNode node) {
_subscription.add(path.path, node, sid, qos);
closeResponse(m['rid']);
}, true, (e, stack) {
}, (e, stack) {
var error = new DSError(
"nodeError",
msg: e.toString(),
Expand All @@ -237,9 +236,9 @@ class Responder extends ConnectionHandler {
}
}

void _getNode(Path p, Taker<LocalNode> func, bool store, [TwoTaker<dynamic, dynamic> onError]) {
void _getNode(Path p, Taker<LocalNode> func, [TwoTaker<dynamic, dynamic> onError]) {
try {
LocalNode node = nodeProvider.getOrCreateNode(p.path, store);
LocalNode node = nodeProvider.getOrCreateNode(p.path, false);

if (node is WaitForMe) {
(node as WaitForMe).onLoaded.then((n) {
Expand Down Expand Up @@ -383,7 +382,7 @@ class Responder extends ConnectionHandler {
closeResponse(m['rid'], error: DSError.PERMISSION_DENIED);
}
closeResponse(m['rid']);
}, false, (e, stack) {
}, (e, stack) {
var error = new DSError(
"nodeError",
msg: e.toString(),
Expand Down Expand Up @@ -412,7 +411,7 @@ class Responder extends ConnectionHandler {
closeResponse(m['rid'], error: DSError.PERMISSION_DENIED);
} else {
node.setAttribute(
path.name, value, this, addResponse(new Response(this, rid)));
path.name, value, this, addResponse(new Response(this, rid)));
}
} else {
// shouldn't be possible to reach here
Expand Down Expand Up @@ -488,7 +487,7 @@ class Responder extends ConnectionHandler {

void addTraceCallback(ResponseTraceCallback _traceCallback) {
_subscription.addTraceCallback(_traceCallback);
_responses.forEach((int rid, Response response) {
_responses.forEach((int rid, Response response){
_traceCallback(response.getTraceData());
});

Expand Down

0 comments on commit e89dd5d

Please sign in to comment.