1

Resolved

SessionClosed event may not be fired when a connection is closed by remote peer.

description

Problem

If a connection is closed by the remote peer, a session may be stopped without being removed and notifying SessionClosed event, in which case the application will never know that this session has been terminated.

This is caused by incorrectly handling Socket Errors in SocketAsyncEventArgs.Completed callbacks, where SocketError.OperationAborted & SocketError.Interrupted are falsely ignored.

Solution

[changeset:d97272f71887] fixes this issue.

Backward compatibility

No backward compatibility problems are expected.

Workaround

If you cannot upgrade to latest code, you can apply below workarounds:

WriteToClosedSessionException

If messages are written to a session whose underlying socket is actually disconnected, you can expect a WriteToClosedSessionException in the ExceptionCaught event.

comments