From 301281737c80ab149546c1b4c2fbaaec2afc1ea0 Mon Sep 17 00:00:00 2001 From: icedream Date: Thu, 15 May 2014 06:06:59 +0200 Subject: [PATCH] Only throw errors in reading loop in Debug builds. --- src/libnpsharp/NPServer.cs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/libnpsharp/NPServer.cs b/src/libnpsharp/NPServer.cs index 19871cc..75b54ed 100644 --- a/src/libnpsharp/NPServer.cs +++ b/src/libnpsharp/NPServer.cs @@ -570,14 +570,25 @@ namespace NPSharp #endif _log.Debug("Client connected"); OnClientConnected(client); +#if !DEBUG + try +#endif + { while (true) { var msg = client.RPC.Read(); if (msg == null) break; } - _log.Debug("Client disconnected"); - OnClientDisconnected(client); + } +#if !DEBUG + catch (Exception error) + { + _log.Error("Error in RPC read loop", error); + } +#endif + _log.Debug("Client disconnected"); + OnClientDisconnected(client); #if !DEBUG } catch (Exception error)