@@ -230,6 +230,7 @@ function amqpTypeToLength(string $type, string $e): array
230230$ connectionContent .= "use Bunny \\Protocol \\MethodFrame; \n" ;
231231$ connectionContent .= "use Bunny \\Protocol \\ProtocolReader; \n" ;
232232$ connectionContent .= "use Bunny \\Protocol \\ProtocolWriter; \n" ;
233+ $ connectionContent .= "use Closure; \n" ;
233234$ connectionContent .= "use Evenement \\EventEmitterInterface; \n" ;
234235$ connectionContent .= "use Evenement \\EventEmitterTrait; \n" ;
235236$ connectionContent .= "use React \\EventLoop \\Loop; \n" ;
@@ -270,15 +271,17 @@ function amqpTypeToLength(string $type, string $e): array
270271$ connectionContent .= " /** @var array<array{filter: (callable(\Bunny\Protocol\AbstractFrame): bool), promise: \React\Promise\Deferred<\Bunny\Protocol\AbstractFrame>}> */ \n" ;
271272$ connectionContent .= " private array \$awaitList = []; \n" ;
272273$ connectionContent .= "\n" ;
274+ $ connectionContent .= " /** @param (Closure(): int) \$frameMax */ \n" ;
273275$ connectionContent .= " public function __construct( \n" ;
274- $ connectionContent .= " private readonly Client \$client, \n" ;
276+ $ connectionContent .= " private readonly ClientInterface \$client, \n" ;
275277$ connectionContent .= " private readonly ConnectionInterface \$connection, \n" ;
276278$ connectionContent .= " private readonly Buffer \$readBuffer, \n" ;
277279$ connectionContent .= " private readonly Buffer \$writeBuffer, \n" ;
278280$ connectionContent .= " private readonly ProtocolReader \$reader, \n" ;
279281$ connectionContent .= " private readonly ProtocolWriter \$writer, \n" ;
280282$ connectionContent .= " private readonly Channels \$channels, \n" ;
281283$ connectionContent .= " private readonly Configuration \$configuration, \n" ;
284+ $ connectionContent .= " private readonly Closure \$frameMax, \n" ;
282285$ connectionContent .= " ) { \n" ;
283286$ connectionContent .= " \$this->connection->on('data', function (string \$data): void { \n" ;
284287$ connectionContent .= " \$this->readBuffer->append( \$data); \n" ;
@@ -899,7 +902,7 @@ function amqpTypeToLength(string $type, string $e): array
899902 $ connectionContent .= " } \n\n" ;
900903 }
901904
902- $ connectionContent .= " for ( \$payloadMax = \$this->client-> frameMax - 8 /* frame preface and frame end */, \$i = 0, \$l = strlen( \$body); \$i < \$l; \$i += \$payloadMax) { \n" ;
905+ $ connectionContent .= " for ( \$payloadMax = ( \$this->frameMax)() - 8 /* frame preface and frame end */, \$i = 0, \$l = strlen( \$body); \$i < \$l; \$i += \$payloadMax) { \n" ;
903906 $ connectionContent .= " \$payloadSize = \$l - \$i; \n" ;
904907 $ connectionContent .= " if ( \$payloadSize > \$payloadMax) { \n" ;
905908 $ connectionContent .= " \$payloadSize = \$payloadMax; \n" ;
0 commit comments