From 7e5f2a630846ae8ab8d0e063d36e7a05bd54b753 Mon Sep 17 00:00:00 2001 From: antiduh Date: Fri, 27 Jun 2014 21:59:19 +0000 Subject: [PATCH] Fixed the demo's CustomServer confusion over Disconnected - it was firing it when a full shutdown occurred, not just when the current client disconnected. Created a second Stopped event to track when the full shutdown actually occurs; still not used by UI. --- TestProtocol/CustomServer.cs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/TestProtocol/CustomServer.cs b/TestProtocol/CustomServer.cs index f5c6af0..4906289 100644 --- a/TestProtocol/CustomServer.cs +++ b/TestProtocol/CustomServer.cs @@ -38,6 +38,8 @@ namespace TestProtocol public event Action Disconnected; + public event Action Stopped; + public void StartServer( int port ) { if( this.running ) @@ -133,13 +135,12 @@ namespace TestProtocol try { - if( this.Disconnected != null ) + if( this.Stopped != null ) { - this.Disconnected(); + this.Stopped(); } } - catch - { } + finally { } } } @@ -208,6 +209,15 @@ namespace TestProtocol } } + + try + { + if( this.Disconnected != null ) + { + this.Disconnected(); + } + } + catch { } } }