private async Task OpenTwinSenderLinkAsync(AmqpIoTSession amqpIoTSession, string correlationIdSuffix, TimeSpan timeout) { if (_twinSendingLink == null || _twinSendingLink.IsClosing()) { _twinSendingLink?.SafeClose(); _twinSendingLink = await amqpIoTSession.OpenTwinSenderLinkAsync(_deviceIdentity, correlationIdSuffix, timeout).ConfigureAwait(false); _twinSendingLink.Closed += (obj, arg) => { amqpIoTSession.SafeClose(); }; Logging.Associate(this, _twinSendingLink, nameof(_twinSendingLink)); } }
private async Task OpenMethodsSenderLinkAsync(AmqpIoTSession amqpIoTSession, string correlationIdSuffix, TimeSpan timeout) { if (_methodSendingLink == null || _methodSendingLink.IsClosing()) { _methodSendingLink?.SafeClose(); _methodSendingLink = await amqpIoTSession.OpenMethodsSenderLinkAsync(_deviceIdentity, correlationIdSuffix, timeout).ConfigureAwait(false); _methodSendingLink.Closed += (obj, arg) => { amqpIoTSession.SafeClose(); }; if (Logging.IsEnabled) { Logging.Associate(this, _methodSendingLink, $"{nameof(_methodSendingLink)}"); } } }