|
@@ -907,9 +907,12 @@ namespace ENet {
|
|
|
public const uint timeoutLimit = 32;
|
|
public const uint timeoutLimit = 32;
|
|
|
public const uint timeoutMinimum = 5000;
|
|
public const uint timeoutMinimum = 5000;
|
|
|
public const uint timeoutMaximum = 30000;
|
|
public const uint timeoutMaximum = 30000;
|
|
|
- public const uint version = (2 << 16) | (3 << 8) | (9);
|
|
|
|
|
|
|
+ public const uint version = (2 << 16) | (4 << 8) | (0);
|
|
|
|
|
|
|
|
public static bool Initialize() {
|
|
public static bool Initialize() {
|
|
|
|
|
+ if (Native.enet_linked_version() != version)
|
|
|
|
|
+ throw new InvalidOperationException("Incompatatible version");
|
|
|
|
|
+
|
|
|
return Native.enet_initialize() == 0;
|
|
return Native.enet_initialize() == 0;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -917,6 +920,9 @@ namespace ENet {
|
|
|
if (callbacks == null)
|
|
if (callbacks == null)
|
|
|
throw new ArgumentNullException("callbacks");
|
|
throw new ArgumentNullException("callbacks");
|
|
|
|
|
|
|
|
|
|
+ if (Native.enet_linked_version() != version)
|
|
|
|
|
+ throw new InvalidOperationException("Incompatatible version");
|
|
|
|
|
+
|
|
|
ENetCallbacks nativeCallbacks = callbacks.NativeData;
|
|
ENetCallbacks nativeCallbacks = callbacks.NativeData;
|
|
|
|
|
|
|
|
return Native.enet_initialize_with_callbacks(version, ref nativeCallbacks) == 0;
|
|
return Native.enet_initialize_with_callbacks(version, ref nativeCallbacks) == 0;
|
|
@@ -950,6 +956,9 @@ namespace ENet {
|
|
|
[DllImport(nativeLibrary, CallingConvention = CallingConvention.Cdecl)]
|
|
[DllImport(nativeLibrary, CallingConvention = CallingConvention.Cdecl)]
|
|
|
internal static extern void enet_deinitialize();
|
|
internal static extern void enet_deinitialize();
|
|
|
|
|
|
|
|
|
|
+ [DllImport(nativeLibrary, CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
|
+ internal static extern uint enet_linked_version();
|
|
|
|
|
+
|
|
|
[DllImport(nativeLibrary, CallingConvention = CallingConvention.Cdecl)]
|
|
[DllImport(nativeLibrary, CallingConvention = CallingConvention.Cdecl)]
|
|
|
internal static extern uint enet_time_get();
|
|
internal static extern uint enet_time_get();
|
|
|
|
|
|
|
@@ -1130,4 +1139,4 @@ namespace ENet {
|
|
|
[DllImport(nativeLibrary, CallingConvention = CallingConvention.Cdecl)]
|
|
[DllImport(nativeLibrary, CallingConvention = CallingConvention.Cdecl)]
|
|
|
internal static extern void enet_peer_reset(IntPtr peer);
|
|
internal static extern void enet_peer_reset(IntPtr peer);
|
|
|
}
|
|
}
|
|
|
-}
|
|
|
|
|
|
|
+}
|