async void connection_Error(object sender, ConnectionErrorEventArgs e) { await @lock.WriterLockAsync(); try { if (connection == sender) LogoutInner(LogoutReason.ConnectionError, e.Exception); } finally { @lock.WriterRelease(); } }
void OnError(ConnectionErrorEventArgs e) { EventHandler<ConnectionErrorEventArgs> handler = Error; if (handler != null) handler(this, e); }