Skip to content

Commit

Permalink
Fix $restore callback calls
Browse files Browse the repository at this point in the history
  • Loading branch information
bwoebi committed Mar 30, 2017
1 parent 31d2956 commit 21801b0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lib/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ public function __construct($config, $sslOptions = null) {
$cb($hash);
}
};
$restore = static function() use ($hash, $config) {
$restore = static function($init) use ($hash, $config) {
$cb = $config->restore;
if (isset($cb)) {
$cb($hash);
$cb($hash, $init);
}
};
$this->processor = new Processor($ready, $busy, $restore);
Expand Down
6 changes: 3 additions & 3 deletions lib/Processor.php
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ private function parseOk($packet) {

if ($this->capabilities & self::CLIENT_SESSION_TRACK) {
// Even though it seems required according to 14.1.3.1, there is no length encoded string, i.e. no trailing NULL byte ....???
if (\strlen($packet) > 7) {

This comment has been minimized.

Copy link
@marcioAlmada

marcioAlmada Apr 6, 2017

Contributor

Is this change related to #29 ?

if (\strlen($packet) > $off) {
$this->connInfo->statusInfo = DataTypes::decodeStringOff($packet, $off);

if ($this->connInfo->statusFlags & StatusFlags::SERVER_SESSION_STATE_CHANGED) {
Expand Down Expand Up @@ -948,8 +948,8 @@ private function goneAway() {
}
}
$this->closeSocket();
if (null !== $cb = $this->config->restore) {
$cb(spl_object_hash($this), $this->connectionState < self::READY);
if (null !== $cb = $this->restore) {
$cb($this->connectionState < self::READY);
/* @TODO if packet not completely sent, resend? */
}
}
Expand Down

0 comments on commit 21801b0

Please sign in to comment.