From 171df40d8568b0d40417ce77a87d5b2a035d4722 Mon Sep 17 00:00:00 2001 From: sta Date: Mon, 1 Dec 2014 15:21:50 +0900 Subject: [PATCH] Refactored HttpConnection.cs --- websocket-sharp/Net/HttpConnection.cs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/websocket-sharp/Net/HttpConnection.cs b/websocket-sharp/Net/HttpConnection.cs index 4a2ae384..bca566c7 100644 --- a/websocket-sharp/Net/HttpConnection.cs +++ b/websocket-sharp/Net/HttpConnection.cs @@ -395,18 +395,21 @@ namespace WebSocketSharp.Net private void removeConnection () { - if (_lastListener == null) + if (_lastListener == null) { _listener.RemoveConnection (this); - else - _lastListener.RemoveConnection (this); + return; + } + + _lastListener.RemoveConnection (this); } private void unbind () { - if (_contextWasBound) { - _listener.UnbindContext (_context); - _contextWasBound = false; - } + if (!_contextWasBound) + return; + + _listener.UnbindContext (_context); + _contextWasBound = false; } #endregion