Skip to content

Commit

Permalink
chore: record bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
DingpingZhang committed Apr 16, 2023
1 parent ca74f69 commit 0c483cc
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
6 changes: 6 additions & 0 deletions HandyIpc.Tests/EventTypeTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ private static async Task TestEventHandlerSubscribeAndUnsubscribe(IEventType ins
int count = 0;
Task WrapAsAsync(IEventType source)
{
/*
* BUG: 以下代码,若是严格以 ADD-RAISE-REMOVE 为一组执行,则是正常的,但由于 RAISE 是(非阻塞)异步的(仅用 Push 方法添加事件到队列),
* 故有可能造成这样的执行顺序:ADD1-RAISE1-ADD2-REMOVE1-RAISE2,其中 ADD2 由于 Dispatcher.g.cs 中的“引用计数”机制,是不会发送订阅事件的,
* 故 REMOVE1 将移除 Server 端的订阅,造成 Server 没有 connection 来处理 RAISE2 的消息,故 await WrapAsAsync() 将永远等待下去。。
*/

TaskCompletionSource tcs = new();
source.Changed += OnChanged;
source.RaiseChanged(EventArgs.Empty);
Expand Down
1 change: 0 additions & 1 deletion HandyIpc/Core/NotifierManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ namespace HandyIpc.Core
{
public class NotifierManager
{
private readonly object _locker = new();
private readonly ISerializer _serializer;
private readonly ConcurrentDictionary<string, Notifier> _notifiers = new();

Expand Down
13 changes: 13 additions & 0 deletions HandyIpc/TypeExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@

namespace HandyIpc
{
public class BoastcastEvent<T>
{
public IDisposable Subscribe(Action<T> handler)
{
return null!;
}

public void Publish(T message)
{

}
}

internal static class TypeExtensions
{
internal static string GetDefaultKey(this Type interfaceType)
Expand Down

0 comments on commit 0c483cc

Please sign in to comment.