From 596cf1d75681fda9723c83bd5cc54ec89c89efa3 Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Wed, 27 Sep 2017 13:19:53 -0400 Subject: [PATCH] Cached channels are checked to see if they are alive before being returned --- TGServiceInterface/Server.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/TGServiceInterface/Server.cs b/TGServiceInterface/Server.cs index 60a67df326..9078e11aec 100644 --- a/TGServiceInterface/Server.cs +++ b/TGServiceInterface/Server.cs @@ -135,7 +135,10 @@ namespace TGServiceInterface if (ChannelFactoryCache.ContainsKey(tot)) try { - return ((ChannelFactory)ChannelFactoryCache[tot]).CreateChannel(); + cf = ((ChannelFactory)ChannelFactoryCache[tot]); + if (cf.State != CommunicationState.Opened) + throw new Exception(); + return cf.CreateChannel(); } catch {