Browse Source

Sync wrapper with the latest changes

NX 6 years ago
parent
commit
e57de7a4e7
1 changed files with 6 additions and 11 deletions
  1. 6 11
      Source/Managed/ENet.cs

+ 6 - 11
Source/Managed/ENet.cs

@@ -35,7 +35,7 @@ namespace ENet {
 		Reliable = 1 << 0,
 		Unsequenced = 1 << 1,
 		NoAllocate = 1 << 2,
-		UnreliableFragment = 1 << 3
+		UnreliableFragmented = 1 << 3
 	}
 
 	public enum EventType {
@@ -63,9 +63,8 @@ namespace ENet {
 	[StructLayout(LayoutKind.Sequential)]
 	public struct ENetAddress {
 		[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
-		public byte[] host;
+		public byte[] ip;
 		public ushort port;
-		public ushort scope;
 	}
 
 	[StructLayout(LayoutKind.Sequential)]
@@ -673,14 +672,10 @@ namespace ENet {
 
 				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;
-				}
 			}
 		}
 
@@ -878,7 +873,7 @@ namespace ENet {
 		public const uint timeoutLimit = 32;
 		public const uint timeoutMinimum = 5000;
 		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() {
 			return Native.enet_initialize() == 0;