Skip to content

Commit

Permalink
Update WebsocketConnection.cs
Browse files Browse the repository at this point in the history
Bug Fix NVentimiglia#17 - Connection.IsOpen returning true after closing it
NVentimiglia#17
  • Loading branch information
Chris Hu authored Aug 22, 2017
1 parent 07a824e commit c76e552
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Websockets.Ios/WebsocketConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public void Close()

_client.Dispose();
_client = null;

IsOpen = false;
var ev = OnClosed;
if (ev != null)
{
Expand Down Expand Up @@ -142,13 +142,14 @@ private void _client_WebSocketOpened(object sender, EventArgs e)

private void _client_WebSocketFailed(object sender, WebSocketFailedEventArgs e)
{

bool wasOpen = IsOpen;
IsOpen = false;
if (e.Error != null)
OnError(e.Error.Description);
else
OnError("Unknown WebSocket Error!");

if (IsOpen)
if (wasOpen)
{
OnClosed();
}
Expand Down

0 comments on commit c76e552

Please sign in to comment.