compatibility with 2.6.0 and 3.1.0
[m6w6/seekat] / lib / API / Call.php
index 787f98db3b24238654bf1a42e0d628247cdc1ed5..26a52ee0995fbff2807d3e4ab850ca97f157eea9 100644 (file)
@@ -56,7 +56,14 @@ class Call extends Deferred implements SplObserver
                });
 
                $client->attach($this);
-               $client->enqueue($request);
+               $client->enqueue($request, function(Response $response) {
+                       $this->response = $response;
+                       $this->complete(
+                               [$this, "resolve"],
+                               [$this, "reject"]
+                       );
+                       return true;
+               });
                /* start off */
                $client->once();
        }
@@ -76,14 +83,6 @@ class Call extends Deferred implements SplObserver
                }
 
                $this->notify((object) compact("client", "request", "progress"));
-
-               if ($progress->info === "finished") {
-                       $this->response = $this->client->getResponse();
-                       $this->complete(
-                               [$this, "resolve"],
-                               [$this, "reject"]
-                       );
-               }
        }
 
        /**
@@ -101,10 +100,8 @@ class Call extends Deferred implements SplObserver
                                $reject($e);
                        }
                } else {
-                       $reject($this->client->getTransferInfo($this->request)["error"]);
+                       $reject($this->client->getTransferInfo($this->request)->error);
                }
-
-               $this->client->dequeue($this->request);
        }
 
        /**