Skip to content

Commit

Permalink
[fix] client close
Browse files Browse the repository at this point in the history
  • Loading branch information
telanflow committed Oct 24, 2019
1 parent 51d4a7f commit 4cb8e88
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/Server/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,19 @@ public function signalHandler($signal)
case SIGUSR2:
case SIGTERM:
$this->exit = true;
$this->client->close();
$this->client->close(true);
file_put_contents(Configure::getPosFile(), $pidFileContent);
exit(0);
}
}

protected function consume(): void
{
$binaryDataReader = new EventBinaryData($this->client->read());
$recvData = $this->client->read();
if (empty($recvData)) {
return;
}

$binaryDataReader = new EventBinaryData($recvData);

// check EOF_Packet -> https://dev.mysql.com/doc/internals/en/packet-EOF_Packet.html
if (self::EOF_HEADER_VALUE === $binaryDataReader->readUInt8()) {
Expand All @@ -118,7 +122,7 @@ protected function consume(): void
$eventInfo = $this->getEventInfo($binaryDataReader);
$eventBuilder = new EventBuilder($binaryDataReader, $eventInfo, $this->cache);

switch($eventInfo->getType())
switch ($eventInfo->getType())
{
case EventTypeConst::TABLE_MAP_EVENT:
$event = $eventBuilder->makeTableMap();
Expand Down

0 comments on commit 4cb8e88

Please sign in to comment.