From 2e5ba4368e968f2fa848835a06f29fb7929defa8 Mon Sep 17 00:00:00 2001 From: Timm Friebe Date: Sun, 21 Jun 2026 18:02:30 +0200 Subject: [PATCH] Refactor I/O exceptions --- composer.json | 2 +- src/main/php/peer/SocketException.class.php | 8 ++++---- src/main/php/peer/server/ForkingServer.class.php | 5 +++-- src/main/php/peer/server/PreforkingServer.class.php | 3 ++- src/main/php/peer/server/Server.class.php | 3 ++- 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/composer.json b/composer.json index 6933cb2..28ea8dc 100755 --- a/composer.json +++ b/composer.json @@ -6,7 +6,7 @@ "description" : "Networking for the XP Framework: Client and server APIs", "keywords": ["module", "xp"], "require" : { - "xp-framework/core": "^12.0 | ^11.0 | ^10.0", + "xp-framework/core": "^12.11 | ^11.11", "xp-framework/logging": "^11.0 | ^10.0", "php" : ">=7.4.0" }, diff --git a/src/main/php/peer/SocketException.class.php b/src/main/php/peer/SocketException.class.php index 0ad6c31..3645655 100755 --- a/src/main/php/peer/SocketException.class.php +++ b/src/main/php/peer/SocketException.class.php @@ -1,8 +1,8 @@ terminate) { try { $m= $this->socket->accept(); - } catch (\io\IOException $e) { + } catch (OperationFailed $e) { $this->shutdown(); break; } @@ -84,7 +85,7 @@ public function service() { do { try { foreach ($this->protocol->handleData($m) ?? [] as $_) { } - } catch (\io\IOException $e) { + } catch (OperationFailed $e) { $this->protocol->handleError($m, $e); break; } diff --git a/src/main/php/peer/server/PreforkingServer.class.php b/src/main/php/peer/server/PreforkingServer.class.php index 94a1a5f..7d67406 100755 --- a/src/main/php/peer/server/PreforkingServer.class.php +++ b/src/main/php/peer/server/PreforkingServer.class.php @@ -1,5 +1,6 @@ protocol->handleData($m) ?? [] as $_) { } - } catch (\io\IOException $e) { + } catch (OperationFailed $e) { $this->protocol->handleError($m, $e); break; } diff --git a/src/main/php/peer/server/Server.class.php b/src/main/php/peer/server/Server.class.php index 5577dba..dbb9aa4 100755 --- a/src/main/php/peer/server/Server.class.php +++ b/src/main/php/peer/server/Server.class.php @@ -1,5 +1,6 @@ protocol->handleData($handles[$index]) ?? [] as $_) { } - } catch (\io\IOException $e) { + } catch (OperationFailed $e) { $this->protocol->handleError($handles[$index], $e); $handles[$index]->close(); unset($handles[$index]);