From 87068bc4f3b8d57a46c0b31de5e3deabfc9bb12b Mon Sep 17 00:00:00 2001 From: sta Date: Mon, 14 Apr 2014 17:34:40 +0900 Subject: [PATCH] Fix a few for WsStream.cs --- websocket-sharp/WsStream.cs | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/websocket-sharp/WsStream.cs b/websocket-sharp/WsStream.cs index c04e9e48..1808c9f5 100644 --- a/websocket-sharp/WsStream.cs +++ b/websocket-sharp/WsStream.cs @@ -182,8 +182,7 @@ namespace WebSocketSharp return new WsStream (conn.Stream, conn.IsSecure); } - internal T ReadHandshake ( - Func parser, int millisecondsTimeout) + internal T ReadHandshake (Func parser, int millisecondsTimeout) where T : HandshakeBase { var timeout = false; @@ -202,8 +201,7 @@ namespace WebSocketSharp handshake = parser (readHandshakeHeaders (_innerStream)); var contentLen = handshake.Headers ["Content-Length"]; if (contentLen != null && contentLen.Length > 0) - handshake.EntityBodyData = readHandshakeEntityBody ( - _innerStream, contentLen); + handshake.EntityBodyData = readHandshakeEntityBody (_innerStream, contentLen); } catch (Exception ex) { exception = ex; @@ -213,14 +211,14 @@ namespace WebSocketSharp timer.Dispose (); } - var reason = timeout - ? "A timeout has occurred while receiving a handshake." - : exception != null - ? "An exception has occurred while receiving a handshake." - : null; + var msg = timeout + ? "A timeout has occurred while receiving a handshake." + : exception != null + ? "An exception has occurred while receiving a handshake." + : null; - if (reason != null) - throw new WebSocketException (reason, exception); + if (msg != null) + throw new WebSocketException (msg, exception); return handshake; } @@ -257,8 +255,7 @@ namespace WebSocketSharp return WsFrame.Parse (_innerStream, true); } - public void ReadFrameAsync ( - Action completed, Action error) + public void ReadFrameAsync (Action completed, Action error) { WsFrame.ParseAsync (_innerStream, true, completed, error); }