From 5b17cf6aca49ae7dea398bf9b48cde3347e4b50e Mon Sep 17 00:00:00 2001 From: yggverse Date: Wed, 17 Jul 2024 10:40:00 +0300 Subject: [PATCH] implement close connection method to free shared memory pool --- src/Abstract/Model/Connection.php | 5 +++++ src/Entity/Browser/Container/Page.php | 13 +++++++++++++ src/Interface/Model/Connection.php | 2 ++ 3 files changed, 20 insertions(+) diff --git a/src/Abstract/Model/Connection.php b/src/Abstract/Model/Connection.php index a2358cbc..29f578c1 100644 --- a/src/Abstract/Model/Connection.php +++ b/src/Abstract/Model/Connection.php @@ -218,4 +218,9 @@ abstract class Connection implements \Yggverse\Yoda\Interface\Model\Connection return null; } + + public function close(): void + { + $this->_pool->reset(); // @TODO + } } \ No newline at end of file diff --git a/src/Entity/Browser/Container/Page.php b/src/Entity/Browser/Container/Page.php index c35efd63..6686301a 100644 --- a/src/Entity/Browser/Container/Page.php +++ b/src/Entity/Browser/Container/Page.php @@ -157,6 +157,7 @@ class Page // Redirect requested if ($location = $connection->getRedirect()) { + // Follow $this->open( $location ); @@ -164,6 +165,9 @@ class Page // Hide progressbar $this->progressbar->hide(); + // Free shared memory pool + $connection->close(); + return false; // stop } @@ -178,6 +182,9 @@ class Page // Hide progressbar $this->progressbar->hide(); + // Free shared memory pool + $connection->close(); + return false; // stop } @@ -230,6 +237,9 @@ class Page // Hide progressbar $this->progressbar->hide(); + // Free shared memory pool + $connection->close(); + // Stop return false; } @@ -250,6 +260,9 @@ class Page // Hide progressbar $this->progressbar->hide(); + // Free shared memory pool + $connection->close(); + // Stop return false; } diff --git a/src/Interface/Model/Connection.php b/src/Interface/Model/Connection.php index f2a74e96..53163c65 100644 --- a/src/Interface/Model/Connection.php +++ b/src/Interface/Model/Connection.php @@ -76,4 +76,6 @@ interface Connection public function unsetRequest(): void; public function getLength(): ?int; + + public function close(): void; } \ No newline at end of file