Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/Servers/HttpSys/src/DelegationRule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys
public class DelegationRule : IDisposable
{
private readonly ILogger _logger;
private readonly UrlGroup _urlGroup;
private readonly UrlGroup _sourceQueueUrlGroup;
private bool _disposed;
/// <summary>
Expand All @@ -32,6 +33,7 @@ internal DelegationRule(UrlGroup sourceQueueUrlGroup, string queueName, string u
QueueName = queueName;
UrlPrefix = urlPrefix;
Queue = new RequestQueue(queueName, UrlPrefix, _logger, receiver: true);
_urlGroup = Queue.UrlGroup;
}

/// <inheritdoc />
Expand All @@ -49,7 +51,7 @@ public void Dispose()
_sourceQueueUrlGroup.UnSetDelegationProperty(Queue, throwOnError: false);
}
catch (ObjectDisposedException) { /* Server may have been shutdown */ }
Queue.UrlGroup.Dispose();
_urlGroup.Dispose();
Queue.Dispose();
}
}
Expand Down
4 changes: 3 additions & 1 deletion src/Servers/HttpSys/test/FunctionalTests/DelegateTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,11 @@ public async Task UpdateDelegationRuleTest()

var delegationProperty = delegator.Features.Get<IServerDelegationFeature>();
destination = delegationProperty.CreateDelegationRule(queueName, receiverAddress);
// Send a request to ensure the rule is fully active
var responseString = await SendRequestAsync(delegatorAddress);
destination?.Dispose();
destination = delegationProperty.CreateDelegationRule(queueName, receiverAddress);
var responseString = await SendRequestAsync(delegatorAddress);
responseString = await SendRequestAsync(delegatorAddress);
Assert.Equal(_expectedResponseString, responseString);
destination?.Dispose();
}
Expand Down