Skip to content

Commit

Permalink
Services: TorServiceHost to be IDisposable (#41)
Browse files Browse the repository at this point in the history
The guards should be killed after the TorServiceHost is
dead and not functioning. This is achieved by implementing
the dispose function. This function should be called by
the end user.
  • Loading branch information
parhamsaremi authored Oct 21, 2022
1 parent 7ad0b22 commit 51bdb10
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions NOnion.Tests/HiddenServicesTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ public async Task EstablishAndCommunicateOverHSConnectionOnionStyle()
});

await TaskUtils.WhenAllFailFast(serverSide, clientSide);

((IDisposable) host).Dispose();
}

[Test]
Expand Down
5 changes: 5 additions & 0 deletions NOnion/Services/TorServiceHost.fs
Original file line number Diff line number Diff line change
Expand Up @@ -819,3 +819,8 @@ type TorServiceHost

member self.ExportPrivateKey() =
masterPrivateKey

interface IDisposable with
member __.Dispose() =
for guard in guardNode do
(guard :> IDisposable).Dispose()

0 comments on commit 51bdb10

Please sign in to comment.