Browse Source

Merge pull request #99 from MoogleTroupe/c#-gc-fix

fix GC issue in c#
pull/8/head
joseph-henry 5 years ago committed by GitHub
parent
commit
b344b88a39
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      src/bindings/csharp/Node.cs

4
src/bindings/csharp/Node.cs

@ -39,6 +39,7 @@ namespace ZeroTier.Core
string _configFilePath;
ushort _servicePort;
static ZeroTierManagedEventCallback _managedCallback;
CSharpCallbackWithStruct _unmanagedCallback;
// Callback used internally to ferry events from the C++ layer
static void OnZeroTierEvent(IntPtr msgPtr)
@ -226,7 +227,8 @@ namespace ZeroTier.Core
if (_hasBeenFreed == true) {
throw new ObjectDisposedException("ZeroTier Node has previously been freed. Restart application to create new instance.");
}
return zts_start(_configFilePath,OnZeroTierEvent,_servicePort);
_unmanagedCallback = OnZeroTierEvent;
return zts_start(_configFilePath,_unmanagedCallback,_servicePort);
}
/// <summary>

Loading…
Cancel
Save