Skip to content

Commit

Permalink
Fixed handling of Error::C_ASYNC_CONNECT_FAILED by the updates wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin Meijer committed Jun 4, 2020
1 parent 0c6f417 commit 93d2f45
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/PHPWebSockets/UpdatesWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ public function update(float $timeout = NULL, array $tempStreams = []) {
$this->_onInvalidStream($update);
break;
case Update\Error::C_ASYNC_CONNECT_FAILED:
$this->_onDisconnect($update);
$this->_onAsyncConnectFailed($update);
break;
default:
throw new \UnexpectedValueException('Unknown or unsupported update code for error: ' . $code);
Expand Down Expand Up @@ -597,4 +597,13 @@ private function _onInvalidStream(Update\Error $update) {
private function _onDisconnectDuringHandshake(Update\Error $update) {
$this->_triggerErrorHandler($update->getSourceConnection(), $update->getCode());
}

private function _onAsyncConnectFailed(Update\Error $update) {

$source = $update->getSourceConnection();

$this->_triggerDisconnectHandler($source, FALSE, NULL);
$this->_handledDisconnects[$source->getResourceIndex()] = TRUE;

}
}

0 comments on commit 93d2f45

Please sign in to comment.