private void AsyncOnExceptionHandler(object error)
{
Exception cause = error as Exception;
MarkTransportFailed(cause);
try
{
this.transport.Dispose();
}
catch(Exception ex)
{
Tracer.Debug("Caught Exception While disposing of Transport: " + ex);
}
this.brokerInfoReceived.countDown();
IList sessionsCopy = null;
lock(this.sessions.SyncRoot)
{
sessionsCopy = new ArrayList(this.sessions);
}
// Use a copy so we don't concurrently modify the Sessions list if the
// client is closing at the same time.
foreach(Session session in sessionsCopy)
{
try
{
session.Shutdown();
}
catch(Exception ex)
{
Tracer.Debug("Caught Exception While disposing of Sessions: " + ex);
}
}
}