From f7ec2321b6ea8e97a6620d4d2eca35564e0ae356 Mon Sep 17 00:00:00 2001 From: "Tristan B. Velloza Kildaire" Date: Sat, 4 Mar 2023 17:42:14 +0200 Subject: [PATCH] Server - Undid the check for data, I don't believe the `receiveTExt()` blocks forever?, We will Have to see --- source/nostril/server.d | 55 +++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 30 deletions(-) diff --git a/source/nostril/server.d b/source/nostril/server.d index d0b21cc..747ce3b 100644 --- a/source/nostril/server.d +++ b/source/nostril/server.d @@ -172,38 +172,33 @@ public class Connection : Fiber */ while(socket.connected() && !hadError) { - /** - * Check if there is data received and then process it - */ - if(socket.dataAvailableForRead()) + /* The received data */ + string data; + + try { - /* The received data */ - string data; - - try - { - // TODO: We could juist cal, this (I presume - I must check) - // ... that this is async I/O fiber vibe (then no need for yield() at end) - data = socket.receiveText(); - } - /* On connection error or format error */ - catch(WebSocketException e) - { - logger.error("Error in receive text"); - hadError = true; - continue; - } - - - try - { - handler(data); - } - catch(Exception e) - { - logger.error("Error in handler"); - } + // TODO: We could juist cal, this (I presume - I must check) + // ... that this is async I/O fiber vibe (then no need for yield() at end) + data = socket.receiveText(); } + /* On connection error or format error */ + catch(WebSocketException e) + { + logger.error("Error in receive text"); + hadError = true; + continue; + } + + + try + { + handler(data); + } + catch(Exception e) + { + logger.error("Error in handler"); + } +