Skip to content

Commit 939f135

Browse files
authored
Merge pull request amphp#31 from marcioAlmada/master
Fix connection pool recovery
2 parents 21801b0 + 3eb0c5f commit 939f135

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/Connection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function __construct($config, $sslOptions = null) {
4040
$restore = static function($init) use ($hash, $config) {
4141
$cb = $config->restore;
4242
if (isset($cb)) {
43-
$cb($hash, $init);
43+
return $cb($hash, $init);
4444
}
4545
};
4646
$this->processor = new Processor($ready, $busy, $restore);

lib/Stmt.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ private function conn() {
3939
}
4040
$restore = $this->conn->restore;
4141
if (isset($restore)) {
42-
$restore()->prepare($this->query)->when(function($error, $stmt) {
42+
$restore(false)->prepare($this->query)->when(function($error, $stmt) {
4343
if ($error) {
4444
while (list(, $args) = $this->virtualConn->getCall()) {
4545
end($args)->fail($error);
@@ -55,7 +55,7 @@ private function conn() {
5555
$args[0] = $this->stmtId;
5656
}
5757
if ($method == "execute") {
58-
$args[1] = &$this->result->params;
58+
$args[2] = &$this->result->params;
5959
}
6060
call_user_func_array([$this->conn(), $method], $args)->when(function($error, $result) use ($deferred) {
6161
if ($error) {
@@ -183,4 +183,4 @@ public function __debugInfo() {
183183

184184
return (array) $tmp;
185185
}
186-
}
186+
}

0 commit comments

Comments
 (0)