Browse Source

NX Repository Commit: b521477
Fixed some bad grammar in his README
Merged latest shit from his repo. Man, almost 10 commits to fix compiler errors... Should have just squashed 'em all into one, bro.

Matthew Coburn 6 years ago
parent
commit
bf041be63a
5 changed files with 294 additions and 220 deletions
  1. 1 1
      ENet-CSharp.nuspec
  2. 7 6
      README.md
  3. 10 13
      Source/Managed/ENet.cs
  4. 275 199
      Source/Native/enet.h
  5. 1 1
      Source/Native/mingw/inet_ntop.c

+ 1 - 1
ENet-CSharp.nuspec

@@ -2,7 +2,7 @@
 <package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
 <package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
   <metadata>
   <metadata>
     <id>ENet-CSharp</id>
     <id>ENet-CSharp</id>
-    <version>2.2.7</version>
+    <version>2.2.8</version>
     <title>ENet-CSharp</title>
     <title>ENet-CSharp</title>
     <authors>Stanislav Denisov</authors>
     <authors>Stanislav Denisov</authors>
     <owners>nxrighthere</owners>
     <owners>nxrighthere</owners>

File diff suppressed because it is too large
+ 7 - 6
README.md


+ 10 - 13
Source/Managed/ENet.cs

@@ -35,7 +35,7 @@ namespace ENet {
 		Reliable = 1 << 0,
 		Reliable = 1 << 0,
 		Unsequenced = 1 << 1,
 		Unsequenced = 1 << 1,
 		NoAllocate = 1 << 2,
 		NoAllocate = 1 << 2,
-		UnreliableFragment = 1 << 3
+		UnreliableFragmented = 1 << 3
 	}
 	}
 
 
 	public enum EventType {
 	public enum EventType {
@@ -63,7 +63,7 @@ namespace ENet {
 	[StructLayout(LayoutKind.Sequential)]
 	[StructLayout(LayoutKind.Sequential)]
 	public struct ENetAddress {
 	public struct ENetAddress {
 		[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
 		[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
-		public byte[] host;
+		public byte[] ip;
 		public ushort port;
 		public ushort port;
 		public ushort scope;
 		public ushort scope;
 	}
 	}
@@ -673,12 +673,9 @@ namespace ENet {
 
 
 				byte[] ip = ArrayPool.GetByteBuffer();
 				byte[] ip = ArrayPool.GetByteBuffer();
 
 
-				if (Native.enet_peer_get_ip(nativePeer, ip, (IntPtr)ip.Length) == 0) {
-					if (Encoding.ASCII.GetString(ip).Remove(7) != "::ffff:")
-						return Encoding.ASCII.GetString(ip, 0, ip.StringLength());
-					else
-						return Encoding.ASCII.GetString(ip, 0, ip.StringLength()).Substring(7);
-				} else {
+				if (Native.enet_peer_get_ip(nativePeer, ip, (IntPtr)ip.Length) == 0)
+					return Encoding.ASCII.GetString(ip, 0, ip.StringLength());
+				else
 					return String.Empty;
 					return String.Empty;
 				}
 				}
 			}
 			}
@@ -781,10 +778,10 @@ namespace ENet {
 				throw new InvalidOperationException("Peer not created");
 				throw new InvalidOperationException("Peer not created");
 		}
 		}
 
 
-		public void ConfigureThrottle(uint interval, uint acceleration, uint deceleration) {
+		public void ConfigureThrottle(uint interval, uint acceleration, uint deceleration, uint threshold) {
 			CheckCreated();
 			CheckCreated();
 
 
-			Native.enet_peer_throttle_configure(nativePeer, interval, acceleration, deceleration);
+			Native.enet_peer_throttle_configure(nativePeer, interval, acceleration, deceleration, threshold);
 		}
 		}
 
 
 		public bool Send(byte channelID, ref Packet packet) {
 		public bool Send(byte channelID, ref Packet packet) {
@@ -878,7 +875,7 @@ 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) | (2 << 8) | (7);
+		public const uint version = (2 << 16) | (2 << 8) | (8);
 
 
 		public static bool Initialize() {
 		public static bool Initialize() {
 			return Native.enet_initialize() == 0;
 			return Native.enet_initialize() == 0;
@@ -1016,7 +1013,7 @@ namespace ENet {
 		internal static extern void enet_host_prevent_connections(IntPtr host, byte state);
 		internal static extern void enet_host_prevent_connections(IntPtr host, byte state);
 
 
 		[DllImport(nativeLibrary, CallingConvention = CallingConvention.Cdecl)]
 		[DllImport(nativeLibrary, CallingConvention = CallingConvention.Cdecl)]
-		internal static extern void enet_peer_throttle_configure(IntPtr peer, uint interval, uint acceleration, uint deceleration);
+		internal static extern void enet_peer_throttle_configure(IntPtr peer, uint interval, uint acceleration, uint deceleration, uint threshold);
 
 
 		[DllImport(nativeLibrary, CallingConvention = CallingConvention.Cdecl)]
 		[DllImport(nativeLibrary, CallingConvention = CallingConvention.Cdecl)]
 		internal static extern uint enet_peer_get_id(IntPtr peer);
 		internal static extern uint enet_peer_get_id(IntPtr peer);
@@ -1087,4 +1084,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);
 	}
 	}
-}
+}

File diff suppressed because it is too large
+ 275 - 199
Source/Native/enet.h


+ 1 - 1
Source/Native/mingw/inet_ntop.c

@@ -89,7 +89,7 @@ static char *inet_ntop4(const u_char * src, char *dst, socklen_t size)
     if (l <= 0 || (socklen_t) l >= size) {
     if (l <= 0 || (socklen_t) l >= size) {
         return (NULL);
         return (NULL);
     }
     }
-//      strlcpy(dst, tmp, size);
+    /* strlcpy(dst, tmp, size); */
     memcpy(dst, tmp, size);
     memcpy(dst, tmp, size);
     dst[size] = '\0';
     dst[size] = '\0';
     return (dst);
     return (dst);

Some files were not shown because too many files changed in this diff