Skip to content

Commit cdcb0df

Browse files
committed
Use zero as default Keep Alive
1 parent 6b21227 commit cdcb0df

File tree

3 files changed

+3
-5
lines changed

3 files changed

+3
-5
lines changed

src/Connector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ private function listenForPackets(Stream $stream)
122122
private function keepAlive(Stream $stream, $keepAlive)
123123
{
124124
if($keepAlive > 0) {
125-
$interval = (int) ($keepAlive / 2);
125+
$interval = $keepAlive / 2;
126126

127127
$this->getLoop()->addPeriodicTimer($interval, function(Timer $timer) use ($stream) {
128128
$packet = new PingRequest($this->version);

src/packet/Connect.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,7 @@ public function __construct(
6464
$willMessage = null,
6565
$willQos = null,
6666
$willRetain = null,
67-
// $keepAlive = 0
68-
$keepAlive = 10
67+
$keepAlive = 0
6968
) {
7069
parent::__construct($version);
7170
$this->clientId = $clientId;

src/packet/ConnectionOptions.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,7 @@ class ConnectionOptions
107107
*
108108
* @var int
109109
*/
110-
// public $keepAlive = 0;
111-
public $keepAlive = 10;
110+
public $keepAlive = 0;
112111

113112
/**
114113
* ConnectionOptions constructor.

0 commit comments

Comments
 (0)