@@ -77,6 +77,7 @@ public function __construct(Stream $stream, ParserInterface $parser = null, Seri
7777 public function __call ($ name , $ args )
7878 {
7979 $ request = new Deferred ();
80+ $ promise = $ request ->promise ();
8081
8182 $ name = strtolower ($ name );
8283
@@ -94,15 +95,15 @@ public function __call($name, $args)
9495
9596 if ($ name === 'monitor ' ) {
9697 $ monitoring =& $ this ->monitoring ;
97- $ request ->then (function () use (&$ monitoring ) {
98+ $ promise ->then (function () use (&$ monitoring ) {
9899 $ monitoring = true ;
99100 });
100101 } elseif (in_array ($ name , $ pubsubs )) {
101102 $ that = $ this ;
102103 $ subscribed =& $ this ->subscribed ;
103104 $ psubscribed =& $ this ->psubscribed ;
104105
105- $ request ->then (function ($ array ) use ($ that , &$ subscribed , &$ psubscribed ) {
106+ $ promise ->then (function ($ array ) use ($ that , &$ subscribed , &$ psubscribed ) {
106107 $ first = array_shift ($ array );
107108
108109 // (p)(un)subscribe messages are to be forwarded
@@ -117,7 +118,7 @@ public function __call($name, $args)
117118 });
118119 }
119120
120- return $ request -> promise () ;
121+ return $ promise ;
121122 }
122123
123124 public function handleMessage (ModelInterface $ message )
0 commit comments