Skip to content
Merged
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
5 changes: 5 additions & 0 deletions test/Tmds.DBus.Protocol.Tests/SignalOwnerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -462,13 +462,15 @@ await clientConnection.AddMatchAsync(methodReturnRule,

// Add third observer with NoSubscribe
var signals3 = 0;
var semaphore3 = new SemaphoreSlim(0);
var observer3 = await clientConnection.AddMatchAsync(rule,
(Message m, object? s) => m.GetBodyReader().ReadString(),
(Exception? ex, string msg, object? rs, object? hs) =>
{
if (ex == null)
{
Interlocked.Increment(ref signals3);
semaphore3.Release();
}
},
null, null, false, ObserverFlags.NoSubscribe);
Expand All @@ -481,9 +483,11 @@ await clientConnection.AddMatchAsync(methodReturnRule,
SendSignal(serviceConnection);
await semaphore1.WaitAsync(TimeSpan.FromSeconds(5));
await semaphore2.WaitAsync(TimeSpan.FromSeconds(5));
await semaphore3.WaitAsync(TimeSpan.FromSeconds(5));

Assert.Equal(1, signals1);
Assert.Equal(1, signals2);
Assert.Equal(1, signals3);

// Remove first observer - name owner watch should still exist
observer1.Dispose();
Expand All @@ -493,6 +497,7 @@ await clientConnection.AddMatchAsync(methodReturnRule,

SendSignal(serviceConnection);
await semaphore2.WaitAsync(TimeSpan.FromSeconds(5));
await semaphore3.WaitAsync(TimeSpan.FromSeconds(5));

Assert.Equal(1, signals1); // Unchanged (observer disposed)
Assert.Equal(2, signals2); // Incremented
Expand Down
Loading