From 0dd335de6761062f8d12965cc0d1aa2c126c4558 Mon Sep 17 00:00:00 2001 From: Dan Garner Date: Tue, 17 Oct 2023 14:24:08 +0100 Subject: [PATCH] Relay needs to wait for response (#43) --- Worker.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Worker.cs b/Worker.cs index af8efe8..6835efb 100644 --- a/Worker.cs +++ b/Worker.cs @@ -267,12 +267,19 @@ Task Relay(CancellationToken stoppingToken) bool result = _relayQueue.TryTake(out string message, -1, stoppingToken); if (result && !string.IsNullOrEmpty(message)) { - _logger.LogDebug("Relay message"); bool sendResult = relaySocket.TrySendFrame(message); if (!sendResult) { _logger.LogError("Unable to relay message"); } + + bool receiveResult = relaySocket.TryReceiveFrameString(TimeSpan.FromMilliseconds(500), out string sendReturn); + if (!receiveResult) + { + _logger.LogError("Unable to relay message, no response"); + } + + _logger.LogDebug("Relay message: {return}", sendReturn); } }