Skip to content
This repository

Fix mutable variable usage inside a closure for outgoing extensions so t... #174

Merged
merged 1 commit into from over 1 year ago

2 participants

Paul Selden James Coglan
Paul Selden

...hat the replies are properly returned if an extension is asynchronous.

Paul Selden Fix mutable variable usage inside a closure for outgoing extensions s…
…o that the replies are properly returned if an extension is asynchronous.
23e8d5e
Paul Selden

Fixes #173

James Coglan jcoglan merged commit 78fb03d into from
James Coglan jcoglan closed this
James Coglan
Collaborator

Thanks, @pselden4!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Nov 16, 2012
Paul Selden Fix mutable variable usage inside a closure for outgoing extensions s…
…o that the replies are properly returned if an extension is asynchronous.
23e8d5e
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 7 additions and 5 deletions. Show diff stats Hide diff stats

  1. 12  javascript/protocol/server.js
12  javascript/protocol/server.js
@@ -48,11 +48,13 @@ Faye.Server = Faye.Class({
48 48
       
49 49
       for (var i = 0, n = replies.length; i < n; i++) {
50 50
         this.debug('Processing reply: ?', replies[i]);
51  
-        this.pipeThroughExtensions('outgoing', replies[i], function(message) {
52  
-          replies[i] = message;
53  
-          extended  += 1;
54  
-          if (extended === expected) gatherReplies(replies);
55  
-        });
  51
+		(function(index) {
  52
+		  self.pipeThroughExtensions('outgoing', replies[index], function(message) {
  53
+			replies[index] = message;
  54
+			extended  += 1;
  55
+			if (extended === expected) gatherReplies(replies);
  56
+	      });
  57
+		})(i);
56 58
       }
57 59
     };
58 60
     
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.