public static void StartBatchOperation(BatchManager <TItem> .PerformFlushAsyncResult thisPtr, IList <BatchManager <TItem> .BatchedObjectsAsyncResult> batchedObjectsAsyncResults) { List <TItem> tItems = new List <TItem>(); foreach (BatchManager <TItem> .BatchedObjectsAsyncResult batchedObjectsAsyncResult in batchedObjectsAsyncResults) { TrackingContext trackingContext = batchedObjectsAsyncResult.TrackingContext; MessagingClientEtwProvider.TraceClient(() => { }); tItems.AddRange(batchedObjectsAsyncResult.BatchedObjects); } try { IAsyncResult batchedBegin = thisPtr.BatchManager.BatchedBegin(thisPtr.TrackingContext, tItems, thisPtr.transactionId, thisPtr.timeout, BatchManager <TItem> .PerformFlushAsyncResult.onFlushCompletionCallback, new Tuple <BatchManager <TItem> .PerformFlushAsyncResult, IList <BatchManager <TItem> .BatchedObjectsAsyncResult> >(thisPtr, batchedObjectsAsyncResults)); if (batchedBegin.CompletedSynchronously) { thisPtr.OnFlushCompleted(batchedBegin, batchedObjectsAsyncResults); } } catch (Exception exception1) { Exception exception = exception1; if (Fx.IsFatal(exception)) { throw; } thisPtr.TryContinueOperation(true, exception, batchedObjectsAsyncResults); } }
public void OnNegotiationSucceed(IPrincipal principal) { MessagingClientEtwProvider.TraceClient <SaslTransport>((SaslTransport source) => MessagingClientEtwProvider.Provider.EventWriteAmqpLogOperation(source, TraceOperation.Execute, "OnNegotiationSucceed"), this); this.negotiator = null; base.Principal = principal; base.CompleteOpen(false, null); }
protected override Message CreateWcfMessage() { string localIdentifier; if (base.Transaction != null) { localIdentifier = base.Transaction.TransactionInformation.LocalIdentifier; } else { localIdentifier = null; } string str = localIdentifier; MessagingClientEtwProvider.TraceClient(() => { }); GetSessionStateCommand getSessionStateCommand = new GetSessionStateCommand() { SessionId = this.sbmpMessageSession.SessionId, Timeout = base.RemainingTime(), TransactionId = str }; GetSessionStateCommand getSessionStateCommand1 = getSessionStateCommand; RequestInfo requestInfo = new RequestInfo() { ServerTimeout = new TimeSpan?(getSessionStateCommand1.Timeout), TransactionId = getSessionStateCommand1.TransactionId }; RequestInfo requestInfo1 = requestInfo; Message message = base.MessageCreator.CreateWcfMessage("http://schemas.microsoft.com/netservices/2011/06/servicebus/SbmpMessageReceiver/GetSessionState", getSessionStateCommand1, this.sbmpMessageSession.parentLinkId, this.sbmpMessageSession.RetryPolicy, this.trackingContext, requestInfo1); return(message); }
private void OnInit(SaslInit init) { SaslCode saslCode = SaslCode.Ok; if (init.InitialResponse.Count > 0) { System.Text.Encoding uTF8 = System.Text.Encoding.UTF8; byte[] array = init.InitialResponse.Array; int offset = init.InitialResponse.Offset; ArraySegment <byte> initialResponse = init.InitialResponse; string str = uTF8.GetString(array, offset, initialResponse.Count); MessagingClientEtwProvider.TraceClient(() => { }); if (this.tokenAuthenticator != null) { try { string[] strArrays = this.tokenAuthenticator(str); base.Principal = new GenericPrincipal(new GenericIdentity("acs-client", SaslSwtHandler.Name), strArrays); } catch (Exception exception) { if (Fx.IsFatal(exception)) { throw; } saslCode = SaslCode.Auth; } } } base.Negotiator.CompleteNegotiation(saslCode, null); }
private static void OnSendTokenComplete(IAsyncResult result) { ActiveClientLinkManager asyncState = (ActiveClientLinkManager)result.AsyncState; try { AmqpCbsLink amqpCbsLink = asyncState.activeClientLink.Link.Session.Connection.Extensions.Find <AmqpCbsLink>() ?? new AmqpCbsLink(asyncState.activeClientLink.Link.Session.Connection); DateTime dateTime = amqpCbsLink.EndSendToken(result); MessagingClientEtwProvider.TraceClient(() => { }); lock (asyncState.syncRoot) { asyncState.activeClientLink.AuthorizationValidToUtc = dateTime; asyncState.ScheduleValidityTimer(); } } catch (Exception exception1) { Exception exception = exception1; if (Fx.IsFatal(exception)) { throw; } MessagingClientEtwProvider.TraceClient(() => MessagingClientEtwProvider.Provider.EventWriteAmqpLogError(asyncState.activeClientLink.Link, "EndSendToken", exception.Message)); asyncState.CancelValidityTimer(); } }
private static void OnFinally(AsyncResult result, Exception exception) { SingletonDictionaryManager <TKey, TInstance> .LoadInstanceAsyncResult instance = (SingletonDictionaryManager <TKey, TInstance> .LoadInstanceAsyncResult)result; if (instance.ownsLoading) { if (exception != null || instance.owner.State != CommunicationState.Opened) { try { if (instance.created) { instance.owner.OnAbortInstance(instance.singletonContext, instance.key, instance.singletonContext.Instance, null); } } finally { lock (instance.owner.ThisLock) { instance.owner.instances.Remove(instance.key); } instance.owner.SignalPendingOperations(instance.key); } } else { lock (instance.owner.ThisLock) { instance.Instance = instance.singletonContext.Instance; instance.singletonContext.State = SingletonDictionaryManager <TKey, TInstance> .SingletonState.Loaded; } instance.owner.SignalPendingOperations(instance.key); MessagingClientEtwProvider.TraceClient(() => MessagingClientEtwProvider.Provider.EventWriteSingletonManagerLoadSucceeded(instance.key.ToString())); } } }
protected virtual void OnReceiveFrameBuffer(ByteBuffer buffer) { string empty = string.Empty; try { empty = "UsageMeter"; if (this.usageMeter != null) { this.usageMeter.OnBytesRead(buffer.Length); } if (base.State > AmqpObjectState.OpenClosePipe) { empty = "FrameBuffer"; this.OnFrameBuffer(buffer); } else { empty = "ProtocolHeader"; ProtocolHeader protocolHeader = new ProtocolHeader(); protocolHeader.Decode(buffer); this.OnProtocolHeader(protocolHeader); } } catch (Exception exception1) { Exception exception = exception1; if (Fx.IsFatal(exception)) { throw; } MessagingClientEtwProvider.TraceClient <AmqpConnectionBase, string, string>((AmqpConnectionBase a, string b, string c) => MessagingClientEtwProvider.Provider.EventWriteAmqpLogError(a, b, c), this, empty, exception.Message); base.SafeClose(exception); } }
public IAsyncResult BeginDeclare(TimeSpan timeout, AsyncCallback callback, object state) { MessagingClientEtwProvider.TraceClient <Controller>((Controller source) => MessagingClientEtwProvider.Provider.EventWriteAmqpLogOperation(source, TraceOperation.Execute, "BeginDeclare"), this); AmqpMessage amqpMessage = Controller.CreateCommandMessage(new Declare()); return(this.sendLink.BeginSendMessage(amqpMessage, this.GetDeliveryTag(), AmqpConstants.NullBinary, timeout, callback, state)); }
private static void OnFinally(AsyncResult result, Exception exception) { if (exception != null) { MessagingClientEtwProvider.TraceClient(() => MessagingClientEtwProvider.Provider.EventWriteLogOperationWarning(exception.ToString(), "SbmpResourceManager.TransactionEnlistment.CreateInstanceAsyncResult.OnFinally")); } }
public bool TrySendTransfer(Delivery delivery, Transfer transfer, ArraySegment <byte>[] payload) { bool flag; lock (base.SyncRoot) { if (this.outgoingWindow != 0) { this.nextOutgoingId.Increment(); AmqpSession.OutgoingSessionChannel outgoingSessionChannel = this; outgoingSessionChannel.outgoingWindow = outgoingSessionChannel.outgoingWindow - 1; if (delivery == null) { transfer.DeliveryId = null; } else { base.AddDelivery(delivery); transfer.DeliveryId = new uint?(delivery.DeliveryId.Value); } base.Session.SendCommand(transfer, payload); return(true); } else { MessagingClientEtwProvider.TraceClient <AmqpSession.OutgoingSessionChannel>((AmqpSession.OutgoingSessionChannel source) => { }, this); flag = false; } } return(flag); }
private static void DispositionTimerCallback(object state) { AmqpSession.SessionChannel sessionChannel = (AmqpSession.SessionChannel)state; if (sessionChannel.session.State != AmqpObjectState.Opened) { return; } MessagingClientEtwProvider.TraceClient <AmqpSession.SessionChannel>((AmqpSession.SessionChannel source) => { }, sessionChannel); lock (sessionChannel.syncRoot) { sessionChannel.timerScheduled = false; if (!sessionChannel.sendingDisposition) { sessionChannel.sendingDisposition = true; } else { return; } } try { sessionChannel.SendDisposition(); } catch (Exception exception1) { Exception exception = exception1; if (Fx.IsFatal(exception)) { throw; } sessionChannel.session.SafeClose(exception); } }
public void OnAcceptTransfer(Delivery delivery, Transfer transfer, bool newDelivery) { if (!this.transferEverReceived) { base.OnReceiveFirstTransfer(transfer); this.transferEverReceived = true; } bool flag = false; lock (base.SyncRoot) { if (this.incomingWindow > 0) { flag = true; if (newDelivery) { base.AddDelivery(delivery); } this.nextIncomingId.Increment(); AmqpSession.IncomingSessionChannel incomingSessionChannel = this; incomingSessionChannel.incomingWindow = incomingSessionChannel.incomingWindow - 1; } } if (!flag) { MessagingClientEtwProvider.TraceClient <AmqpSession.IncomingSessionChannel>((AmqpSession.IncomingSessionChannel source) => { }, this); throw new AmqpException(AmqpError.WindowViolation); } if (!newDelivery) { this.OnWindowMoved(1); } }
private void WriteReplyHeader(ProtocolHeader header, bool fail) { Action <TransportAsyncCallbackArgs> action; MessagingClientEtwProvider.TraceClient <AmqpTransportListener.TransportHandler, ProtocolHeader>((AmqpTransportListener.TransportHandler source, ProtocolHeader detail) => MessagingClientEtwProvider.Provider.EventWriteAmqpLogOperation(source, TraceOperation.Send, detail), this, header); header.Encode(new ByteBuffer(this.buffer)); this.args.SetBuffer(this.buffer, 0, (int)this.buffer.Length); TransportAsyncCallbackArgs transportAsyncCallbackArg = this.args; if (fail) { action = null; } else { action = AmqpTransportListener.TransportHandler.writeCompleteCallback; } transportAsyncCallbackArg.CompletedCallback = action; this.bufferWriter.WriteBuffer(this.args); if (fail) { this.args.Exception = new NotSupportedException(header.ToString()); this.parent.OnHandleTransportComplete(this.args); } }
private static void OnReadHeaderComplete(TransportAsyncCallbackArgs args) { AmqpTransportListener.TransportHandler userToken = (AmqpTransportListener.TransportHandler)args.UserToken; if (args.Exception != null) { userToken.parent.OnHandleTransportComplete(args); return; } ByteBuffer byteBuffer = new ByteBuffer(userToken.buffer, 0, (int)userToken.buffer.Length); try { userToken.OnProtocolHeader(byteBuffer); } catch (Exception exception1) { Exception exception = exception1; if (Fx.IsFatal(exception)) { throw; } MessagingClientEtwProvider.TraceClient <AmqpTransportListener.TransportHandler, Exception>((AmqpTransportListener.TransportHandler source, Exception ex) => MessagingClientEtwProvider.Provider.EventWriteAmqpLogError(source, "OnProtocolHeader", ex.Message), userToken, exception); args.Exception = exception; userToken.parent.OnHandleTransportComplete(args); } }
private static void MessageReceivePump(object state) { bool flag; DuplexRequestBindingElement.DuplexRequestSessionChannel duplexRequestSessionChannel = (DuplexRequestBindingElement.DuplexRequestSessionChannel)state; try { do { flag = false; if (duplexRequestSessionChannel.State != CommunicationState.Opened && duplexRequestSessionChannel.State != CommunicationState.Closing) { continue; } IAsyncResult asyncResult = duplexRequestSessionChannel.innerChannel.BeginTryReceive(TimeSpan.MaxValue, DuplexRequestBindingElement.DuplexRequestSessionChannel.onMessageReceived, duplexRequestSessionChannel); if (!asyncResult.CompletedSynchronously) { continue; } flag = duplexRequestSessionChannel.HandleMessageReceived(asyncResult); }while (flag); } catch (CommunicationException communicationException1) { CommunicationException communicationException = communicationException1; MessagingClientEtwProvider.TraceClient(() => MessagingClientEtwProvider.Provider.EventWriteRuntimeChannelFaulting(duplexRequestSessionChannel.innerChannel.GetType().Name, duplexRequestSessionChannel.innerChannel.LocalAddress.Uri.AbsoluteUri, duplexRequestSessionChannel.innerChannel.RemoteAddress.Uri.AbsoluteUri, duplexRequestSessionChannel.innerChannel.Via.AbsoluteUri, duplexRequestSessionChannel.innerChannel.Session.Id, string.Concat("MessageReceivePump: ", communicationException.ToString()))); duplexRequestSessionChannel.Fault(); } }
private void Abort(bool fromClose) { lock (this.ThisLock) { if (!fromClose) { if (this.raisedClosed || this.isClosing) { return; } } else if (this.raisedClosed) { return; } if (!this.isClosing) { this.isClosing = true; } } MessagingClientEtwProvider.TraceClient(() => { }); this.OnAbort(); this.OnClosed(); }
private void ThrowIfFaultMessage(Message wcfMessage) { Exception exception; if (wcfMessage.IsFault) { MessagingClientEtwProvider.TraceClient(() => { }); string action = wcfMessage.Headers.Action; MessageFault messageFault = MessageFault.CreateFault(wcfMessage, 65536); FaultConverter property = this.innerChannel.GetProperty <FaultConverter>(); if (property == null || !property.TryCreateException(wcfMessage, messageFault, out exception)) { if (!messageFault.HasDetail) { throw Microsoft.ServiceBus.Messaging.FxTrace.Exception.AsWarning(new FaultException(messageFault, action), null); } ExceptionDetail detail = messageFault.GetDetail <ExceptionDetail>(); if (!this.clientMode && string.Equals(detail.Type, typeof(CommunicationException).FullName, StringComparison.Ordinal)) { MessagingClientEtwProvider.TraceClient(() => MessagingClientEtwProvider.Provider.EventWriteRuntimeChannelFaulting(this.innerChannel.GetType().Name, this.innerChannel.LocalAddress.Uri.AbsoluteUri, this.innerChannel.RemoteAddress.Uri.AbsoluteUri, this.innerChannel.Via.AbsoluteUri, this.innerChannel.Session.Id, string.Concat("ThrowIfFaultMessage: Received CommunicationException as fault message. ", detail.ToString()))); base.Fault(); } if (!this.includeExceptionDetails) { throw Microsoft.ServiceBus.Messaging.FxTrace.Exception.AsInformation(new FaultException <ExceptionDetailNoStackTrace>(new ExceptionDetailNoStackTrace(detail, true), messageFault.Reason, messageFault.Code, action), null); } throw Microsoft.ServiceBus.Messaging.FxTrace.Exception.AsInformation(new FaultException <ExceptionDetail>(detail, messageFault.Reason, messageFault.Code, action), null); } throw Fx.Exception.AsWarning(exception, null); } }
internal virtual IAsyncResult BeginClose(TimeSpan timeout, AsyncCallback callback, object state) { IAsyncResult alreadyClosedAsyncResult; lock (this.ThisLock) { if (!this.isClosing) { this.isClosing = true; } else { alreadyClosedAsyncResult = new ClientEntity.AlreadyClosedAsyncResult(callback, state); return(alreadyClosedAsyncResult); } } try { MessagingClientEtwProvider.TraceClient(() => { }); alreadyClosedAsyncResult = this.OnBeginClose(timeout, callback, state); } catch { this.Abort(true); throw; } return(alreadyClosedAsyncResult); }
private void HandleException(string action, Exception exception) { MessagingClientEtwProvider.TraceClient <SaslNegotiator, string, Exception>((SaslNegotiator source, string op, Exception ex) => MessagingClientEtwProvider.Provider.EventWriteAmqpLogError(source, op, ex.Message), this, action, exception); this.state = SaslNegotiator.SaslState.End; this.completeException = exception; this.CompleteTransport(); }
internal virtual void Close(TimeSpan timeout) { lock (this.ThisLock) { if (!this.isClosing) { this.isClosing = true; } else { return; } } try { MessagingClientEtwProvider.TraceClient(() => { }); this.OnClose(timeout); this.OnClosed(); } catch { this.Abort(true); throw; } }
protected override void OnProcessTransfer(Delivery delivery, Transfer transfer, Frame frame) { if (base.Settings.MaxMessageSize.HasValue) { ulong bytesTransfered = (ulong)(this.currentMessage.BytesTransfered + (long)frame.Payload.Count); if (bytesTransfered > base.Settings.MaxMessageSize.Value) { if (!base.IsClosing()) { Microsoft.ServiceBus.Messaging.Amqp.Framing.Error messageSizeExceeded = AmqpError.MessageSizeExceeded; object value = this.currentMessage.DeliveryId.Value; object obj = bytesTransfered; ulong? maxMessageSize = base.Settings.MaxMessageSize; throw new AmqpException(messageSizeExceeded, SRAmqp.AmqpMessageSizeExceeded(value, obj, maxMessageSize.Value)); } return; } } ArraySegment <byte> payload = frame.Payload; frame.RawByteBuffer.AdjustPosition(payload.Offset, payload.Count); frame.RawByteBuffer.Clone(); this.currentMessage.AddPayload(frame.RawByteBuffer, !transfer.More()); if (!transfer.More()) { AmqpMessage amqpMessage = this.currentMessage; this.currentMessage = null; Action <ReceivingAmqpLink, uint, int> action = (ReceivingAmqpLink source, uint id, int count) => { }; SequenceNumber deliveryId = amqpMessage.DeliveryId; MessagingClientEtwProvider.TraceClient <ReceivingAmqpLink, uint, int>(action, this, deliveryId.Value, amqpMessage.RawByteBuffers.Count); this.OnReceiveMessage(amqpMessage); } }
protected override IAsyncResult OnBeginCreateInstance(SingletonDictionaryManager <string, IRequestSessionChannel> .SingletonContext singletonContext, string key, object loadingContext, TimeSpan timeout, AsyncCallback callback, object state) { Uri uri = new Uri(key); EndpointAddress endpointAddress = new EndpointAddress(uri, SbmpProtocolDefaults.GetEndpointIdentity(uri), new AddressHeader[0]); IChannelFactory <IRequestSessionChannel> channelFactory = this.defaultChannelFactory; if (!this.clientMode && loadingContext != null && loadingContext is bool && (bool)loadingContext) { channelFactory = this.securedChannelFactory; } IRequestSessionChannel requestSessionChannel = channelFactory.CreateChannel(endpointAddress); requestSessionChannel.SafeAddFaulted((object s, EventArgs e) => { this.RaiseNotifyCleanup(uri); try { base.BeginUnloadInstance(key, null, true, TimeSpan.FromSeconds(10), new AsyncCallback(ContainerChannelManager.UnloadCallback), this); } catch (Exception exception1) { Exception exception = exception1; if (Fx.IsFatal(exception)) { throw; } MessagingClientEtwProvider.TraceClient(() => MessagingClientEtwProvider.Provider.EventWriteExceptionAsWarning(exception.ToString())); } }); return(new CompletedAsyncResult <IRequestSessionChannel>(requestSessionChannel, callback, state)); }
public SendAsyncResult(SendAvailabilityPairedNamespaceMessageSender sender, TrackingContext trackingContext, IEnumerable <BrokeredMessage> messages, TimeSpan timeout, AsyncCallback callback, object state) : base(timeout, callback, state) { this.sender = sender; this.trackingContext = trackingContext; this.messages = messages; this.messageBuffer = new List <BrokeredMessage>(); try { foreach (BrokeredMessage message in this.messages) { message.IsConsumed = false; this.messageBuffer.Add(message.Clone()); } } catch (Exception exception1) { Exception exception = exception1; MessagingClientEtwProvider.TraceClient(() => MessagingClientEtwProvider.Provider.EventWriteRetryPolicyStreamNotClonable(this.trackingContext.Activity, this.trackingContext.TrackingId, "PairnedNamespaceSender", "Send", exception.GetType().FullName, exception.Message)); foreach (BrokeredMessage brokeredMessage in this.messageBuffer) { brokeredMessage.Dispose(); } this.messageBuffer.Clear(); } base.Start(); }
protected override IRequestSessionChannel OnCreateChannel(EndpointAddress address, Uri via) { IDuplexSessionChannel duplexSessionChannel = this.innerFactory.CreateChannel(address, via); MessagingClientEtwProvider.TraceClient(() => MessagingClientEtwProvider.Provider.EventWriteRuntimeChannelCreated(duplexSessionChannel.GetType().Name, duplexSessionChannel.LocalAddress.Uri.AbsoluteUri, duplexSessionChannel.RemoteAddress.Uri.AbsoluteUri, duplexSessionChannel.Via.AbsoluteUri, duplexSessionChannel.Session.Id)); return(new DuplexRequestBindingElement.DuplexRequestSessionChannel(this, duplexSessionChannel)); }
public void OnNegotiationFail(Exception exception) { MessagingClientEtwProvider.TraceClient <SaslTransport, Exception>((SaslTransport source, Exception ex) => MessagingClientEtwProvider.Provider.EventWriteAmqpLogError(source, "OnNegotiationFail", ex.Message), this, exception); this.negotiator = null; this.innerTransport.SafeClose(exception); base.CompleteOpen(false, exception); }
private static void BeginPing(object state) { DuplexRequestBindingElement.DuplexRequestSessionChannel duplexRequestSessionChannel = (DuplexRequestBindingElement.DuplexRequestSessionChannel)state; CommunicationState communicationState = duplexRequestSessionChannel.State; if (communicationState != CommunicationState.Opened) { MessagingClientEtwProvider.TraceClient(() => MessagingClientEtwProvider.Provider.EventWriteRuntimeChannelPingIncorrectState(duplexRequestSessionChannel.innerChannel.GetType().Name, duplexRequestSessionChannel.innerChannel.LocalAddress.Uri.AbsoluteUri, (duplexRequestSessionChannel.innerChannel.RemoteAddress == null ? "Null" : duplexRequestSessionChannel.innerChannel.RemoteAddress.Uri.AbsoluteUri), (duplexRequestSessionChannel.innerChannel.Via == null ? "Null" : duplexRequestSessionChannel.innerChannel.Via.AbsoluteUri), duplexRequestSessionChannel.innerChannel.Session.Id, communicationState.ToString())); return; } Message message = Message.CreateMessage(duplexRequestSessionChannel.messageVersion, "http://schemas.microsoft.com/servicebus/2010/08/protocol/Ping", new Microsoft.ServiceBus.Messaging.Channels.PingMessage()); try { duplexRequestSessionChannel.innerChannel.BeginSend(message, SbmpConstants.ConnectionPingOperationTimeout, DuplexRequestBindingElement.DuplexRequestSessionChannel.endPing, duplexRequestSessionChannel); } catch (Exception exception1) { Exception exception = exception1; if (Fx.IsFatal(exception)) { throw; } MessagingClientEtwProvider.TraceClient(() => MessagingClientEtwProvider.Provider.EventWriteRuntimeChannelPingFailed(duplexRequestSessionChannel.innerChannel.GetType().Name, duplexRequestSessionChannel.innerChannel.LocalAddress.Uri.AbsoluteUri, (duplexRequestSessionChannel.innerChannel.RemoteAddress == null ? "Null" : duplexRequestSessionChannel.innerChannel.RemoteAddress.Uri.AbsoluteUri), (duplexRequestSessionChannel.innerChannel.Via == null ? "Null" : duplexRequestSessionChannel.innerChannel.Via.AbsoluteUri), duplexRequestSessionChannel.innerChannel.Session.Id, exception.ToString())); } }
protected override Message CreateWcfMessage() { string localIdentifier; MessagingClientEtwProvider.TraceClient(() => { }); Transaction transaction = base.Transaction; SessionRenewLockCommand sessionRenewLockCommand = new SessionRenewLockCommand() { SessionId = this.sbmpMessageSession.SessionId, Timeout = base.RemainingTime() }; SessionRenewLockCommand sessionRenewLockCommand1 = sessionRenewLockCommand; RequestInfo requestInfo = new RequestInfo() { ServerTimeout = new TimeSpan?(sessionRenewLockCommand1.Timeout) }; RequestInfo requestInfo1 = requestInfo; if (transaction != null) { localIdentifier = transaction.TransactionInformation.LocalIdentifier; } else { localIdentifier = null; } requestInfo1.TransactionId = localIdentifier; RequestInfo requestInfo2 = requestInfo; Message message = base.MessageCreator.CreateWcfMessage("http://schemas.microsoft.com/netservices/2011/06/servicebus/SbmpMessageReceiver/SessionRenewLock", sessionRenewLockCommand1, this.sbmpMessageSession.parentLinkId, this.sbmpMessageSession.RetryPolicy, this.trackingContext, requestInfo2); return(message); }
private static void EndPing(IAsyncResult result) { DuplexRequestBindingElement.DuplexRequestSessionChannel asyncState = (DuplexRequestBindingElement.DuplexRequestSessionChannel)result.AsyncState; try { asyncState.innerChannel.EndSend(result); lock (asyncState.pingTimer) { CommunicationState state = asyncState.State; if (state == CommunicationState.Opened && asyncState.inflightRequests.Count > 0) { asyncState.pingTimer.Set(SbmpConstants.ConnectionPingTimeout); } else if (state != CommunicationState.Opened) { MessagingClientEtwProvider.TraceClient(() => MessagingClientEtwProvider.Provider.EventWriteRuntimeChannelStopPingWithIncorrectState(asyncState.innerChannel.GetType().Name, asyncState.innerChannel.LocalAddress.Uri.AbsoluteUri, (asyncState.innerChannel.RemoteAddress == null ? "Null" : asyncState.innerChannel.RemoteAddress.Uri.AbsoluteUri), (asyncState.innerChannel.Via == null ? "Null" : asyncState.innerChannel.Via.AbsoluteUri), asyncState.innerChannel.Session.Id, state.ToString(), asyncState.inflightRequests.Count)); } } } catch (Exception exception1) { Exception exception = exception1; if (Fx.IsFatal(exception)) { throw; } MessagingClientEtwProvider.TraceClient(() => MessagingClientEtwProvider.Provider.EventWriteRuntimeChannelPingFailed(asyncState.innerChannel.GetType().Name, asyncState.innerChannel.LocalAddress.Uri.AbsoluteUri, (asyncState.innerChannel.RemoteAddress == null ? "Null" : asyncState.innerChannel.RemoteAddress.Uri.AbsoluteUri), (asyncState.innerChannel.Via == null ? "Null" : asyncState.innerChannel.Via.AbsoluteUri), asyncState.innerChannel.Session.Id, exception.ToString())); } }
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); }
static DiagnosticTrace() { DiagnosticTrace.defaultEtwProviderId = (MessagingClientEtwProvider.IsEtwEnabled() ? MessagingClientEtwProvider.Provider.Guid : new Guid("A307C7A2-A4CD-4D22-8093-94DB72934152")); DiagnosticTrace.etwProviderCache = new Hashtable(); DiagnosticTrace.isVistaOrGreater = Environment.OSVersion.Version.Major >= 6; DiagnosticTrace.appDomainFriendlyName = AppDomain.CurrentDomain.FriendlyName; }