Skip to content

Commit

Permalink
remove session when socket is closed
Browse files Browse the repository at this point in the history
  • Loading branch information
longshine committed May 14, 2014
1 parent 20db663 commit d97272f
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions Mina.NET/Transport/Socket/AsyncSocketSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,17 @@ public void ProcessSend(SocketAsyncEventArgs e)
{
EndSend(e.BytesTransferred);
}
else
else if (e.SocketError != SocketError.OperationAborted
&& e.SocketError != SocketError.Interrupted
&& e.SocketError != SocketError.ConnectionReset)
{
EndSend(new SocketException((Int32)e.SocketError));
}
else
{
// closed
Processor.Remove(this);
}
}

/// <inheritdoc/>
Expand Down Expand Up @@ -213,10 +220,16 @@ public void ProcessReceive(SocketAsyncEventArgs e)
}
}
else if (e.SocketError != SocketError.OperationAborted
&& e.SocketError != SocketError.Interrupted)
&& e.SocketError != SocketError.Interrupted
&& e.SocketError != SocketError.ConnectionReset)
{
EndReceive(new SocketException((Int32)e.SocketError));
}
else
{
// closed
Processor.Remove(this);
}
}
}
}

0 comments on commit d97272f

Please sign in to comment.