Skip to content

Commit

Permalink
When a connection close is requested, respond with Close-Ok
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromegamez committed May 23, 2024
1 parent 1f176b0 commit 29d541e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
11 changes: 7 additions & 4 deletions spec/generate.php
Original file line number Diff line number Diff line change
Expand Up @@ -894,10 +894,13 @@ function amqpTypeToLength($type, $e)
$connectionContent .= " \$deferred = new Deferred();\n";
$connectionContent .= " \$this->awaitList[] = [\n";
$connectionContent .= " 'filter' => function (Protocol\\AbstractFrame \$frame)" . ($class->id !== 10 ? " use (\$channel)" : "") . ": bool {\n";
$connectionContent .= " if (\$frame instanceof Protocol\\{$className}" . ($class->id !== 10 ? " && \$frame->channel === \$channel" : "") . ") {\n";
$connectionContent .= " return true;\n";
$connectionContent .= " }\n";
$connectionContent .= "\n";

if ($class->id !== 10 || $method->id !== 50) {
$connectionContent .= " if (\$frame instanceof Protocol\\{$className}" . ($class->id !== 10 ? " && \$frame->channel === \$channel" : "") . ") {\n";
$connectionContent .= " return true;\n";
$connectionContent .= " }\n";
$connectionContent .= "\n";
}

if ($class->id === 60 && $method->id === 71) {
$connectionContent .= " if (\$frame instanceof Protocol\\" . str_replace("GetOk", "GetEmpty", $className) . ($class->id !== 10 ? " && \$frame->channel === \$channel" : "") . ") {\n";
Expand Down
4 changes: 0 additions & 4 deletions src/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -363,10 +363,6 @@ public function awaitConnectionClose(): Protocol\MethodConnectionCloseFrame
$deferred = new Deferred();
$this->awaitList[] = [
'filter' => function (Protocol\AbstractFrame $frame): bool {
if ($frame instanceof Protocol\MethodConnectionCloseFrame) {
return true;
}

if ($frame instanceof Protocol\MethodConnectionCloseFrame) {
$this->connectionCloseOk();
throw new ClientException($frame->replyText, $frame->replyCode);
Expand Down

0 comments on commit 29d541e

Please sign in to comment.