Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add shutdown event for plugins #1195

Merged
merged 6 commits into from
Oct 31, 2019
Merged
Show file tree
Hide file tree
Changes from 4 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
2 changes: 2 additions & 0 deletions neo/NeoSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ public NeoSystem(Store store)

public void Dispose()
{
foreach (var p in Plugin.Plugins)
p.Dispose();
RpcServer?.Dispose();
EnsureStoped(LocalNode);
// Dispose will call ActorSystem.Terminate()
Expand Down
6 changes: 5 additions & 1 deletion neo/Plugins/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace Neo.Plugins
{
public abstract class Plugin
public abstract class Plugin : IDisposable
{
public static readonly List<Plugin> Plugins = new List<Plugin>();
private static readonly List<ILogPlugin> Loggers = new List<ILogPlugin>();
Expand Down Expand Up @@ -169,5 +169,9 @@ private static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEven
return null;
}
}

public virtual void Dispose()
{
}
}
}