public void AddSession(AmqpSession session, ushort?channel) { int?nullable1; session.Closed += new EventHandler(this.OnSessionClosed); lock (base.ThisLock) { session.LocalChannel = (ushort)this.sessionsByLocalHandle.Add(session); ushort?nullable2 = channel; if (nullable2.HasValue) { nullable1 = new int?((int)nullable2.GetValueOrDefault()); } else { nullable1 = null; } if (nullable1.HasValue) { this.sessionsByRemoteHandle.Add(channel.Value, session); } } MessagingClientEtwProvider.TraceClient <AmqpConnection, AmqpSession, ushort?>((AmqpConnection source, AmqpSession sess, ushort?ch) => { MessagingClientEventSource provider = MessagingClientEtwProvider.Provider; AmqpConnection amqpConnection = source; AmqpSession amqpSession = sess; ushort localChannel = sess.LocalChannel; ushort?nullable = ch; provider.EventWriteAmqpAddSession(amqpConnection, amqpSession, localChannel, (nullable.HasValue ? nullable.GetValueOrDefault() : 0)); }, this, session, channel); }
public static void Close() { lock (MessagingClientEtwProvider.thisLock) { if (MessagingClientEtwProvider.provider != null) { MessagingClientEtwProvider.diagnostics.Dispose(); MessagingClientEtwProvider.provider.Dispose(); MessagingClientEtwProvider.provider = null; } } }
public void Failure(object sender, Exception exception) { RelayedConnectionSession relayedConnectionSession = (RelayedConnectionSession)sender; MessagingClientEventSource provider = MessagingClientEtwProvider.Provider; EventTraceActivity activity = relayedConnectionSession.Activity; string absoluteUri = this.uri.AbsoluteUri; Guid id = relayedConnectionSession.Id; provider.RelayListenerClientAcceptFailed(activity, absoluteUri, id.ToString(), exception.ToString()); lock (this.ThisLock) { this.connectionSessions.Remove(relayedConnectionSession.Id.ToString()); } relayedConnectionSession.Close(); }