From 3b57b6c1ae719af2d29d65ade3d1727caf530271 Mon Sep 17 00:00:00 2001 From: "Tristan B. Velloza Kildaire" Date: Sun, 30 Apr 2023 00:55:39 +0200 Subject: [PATCH] BClient - handle erroneous `writeFully(byte[])` call in `sendMessage(byte[])` --- source/bformat/sockets.d | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/source/bformat/sockets.d b/source/bformat/sockets.d index c4b9818..f3814f1 100644 --- a/source/bformat/sockets.d +++ b/source/bformat/sockets.d @@ -139,11 +139,17 @@ public class BClient /* Add the message to the buffer */ messageBuffer ~= cast(byte[])message; - /* Send the message */ - long bytesSent = stream.writeFully(messageBuffer); - - /* TODO: Compact this */ - return bytesSent > 0; + try + { + /* Send the message */ + stream.writeFully(messageBuffer); + + return true; + } + catch(StreamException streamError) + { + return false; + } } }