Browse Source

NX Repository Equivilant commit: b9da0a0
Expose host buffer size option
Update ENet-CSharp.nuspec
Update README.md

Matthew Coburn 6 years ago
parent
commit
1937449a1a
3 changed files with 16 additions and 12 deletions
  1. 1 1
      ENet-CSharp.nuspec
  2. 1 1
      README.md
  3. 14 10
      Source/Managed/ENet.cs

+ 1 - 1
ENet-CSharp.nuspec

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

+ 1 - 1
README.md

@@ -227,7 +227,7 @@ Definitions of a flags for `Peer.Send()` function:
 
 `PacketFlags.Reliable` reliable sequenced, a packet must be received by the target peer and resend attempts should be made until the packet is delivered.
 
-`PacketFlags.Unsequenced` a packet will not be sequenced with other packets and may be delivered out of order.
+`PacketFlags.Unsequenced` a packet will not be sequenced with other packets and may be delivered out of order. This flag makes delivery unreliable.
 
 `PacketFlags.NoAllocate` a packet will not allocate data, and the user must supply it instead.
 

+ 14 - 10
Source/Managed/ENet.cs

@@ -461,23 +461,27 @@ namespace ENet {
 			Create(null, 1, 0);
 		}
 
+		public void Create(int bufferSize) {
+			Create(null, 1, 0, 0, 0, bufferSize);
+		}
+
 		public void Create(Address? address, int peerLimit) {
 			Create(address, peerLimit, 0);
 		}
 
 		public void Create(Address? address, int peerLimit, int channelLimit) {
-			Create(address, peerLimit, channelLimit, 0, 0);
+			Create(address, peerLimit, channelLimit, 0, 0, 0);
 		}
 
 		public void Create(int peerLimit, int channelLimit) {
-			Create(null, peerLimit, channelLimit, 0, 0);
+			Create(null, peerLimit, channelLimit, 0, 0, 0);
 		}
 
 		public void Create(int peerLimit, int channelLimit, uint incomingBandwidth, uint outgoingBandwidth) {
-			Create(null, peerLimit, channelLimit, incomingBandwidth, outgoingBandwidth);
+			Create(null, peerLimit, channelLimit, incomingBandwidth, outgoingBandwidth, 0);
 		}
 
-		public void Create(Address? address, int peerLimit, int channelLimit, uint incomingBandwidth, uint outgoingBandwidth) {
+		public void Create(Address? address, int peerLimit, int channelLimit, uint incomingBandwidth, uint outgoingBandwidth, int bufferSize) {
 			if (nativeHost != IntPtr.Zero)
 				throw new InvalidOperationException("Host already created");
 
@@ -489,9 +493,9 @@ namespace ENet {
 			if (address != null) {
 				var nativeAddress = address.Value.NativeData;
 
-				nativeHost = Native.enet_host_create(ref nativeAddress, (IntPtr)peerLimit, (IntPtr)channelLimit, incomingBandwidth, outgoingBandwidth);
+				nativeHost = Native.enet_host_create(ref nativeAddress, (IntPtr)peerLimit, (IntPtr)channelLimit, incomingBandwidth, outgoingBandwidth, bufferSize);
 			} else {
-				nativeHost = Native.enet_host_create(IntPtr.Zero, (IntPtr)peerLimit, (IntPtr)channelLimit, incomingBandwidth, outgoingBandwidth);
+				nativeHost = Native.enet_host_create(IntPtr.Zero, (IntPtr)peerLimit, (IntPtr)channelLimit, incomingBandwidth, outgoingBandwidth, bufferSize);
 			}
 
 			if (nativeHost == IntPtr.Zero)
@@ -870,7 +874,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) | (6);
+		public const uint version = (2 << 16) | (2 << 8) | (7);
 
 		public static bool Initialize() {
 			return Native.enet_initialize() == 0;
@@ -951,10 +955,10 @@ namespace ENet {
 		internal static extern void enet_packet_dispose(IntPtr packet);
 
 		[DllImport(nativeLibrary, CallingConvention = CallingConvention.Cdecl)]
-		internal static extern IntPtr enet_host_create(ref ENetAddress address, IntPtr peerLimit, IntPtr channelLimit, uint incomingBandwidth, uint outgoingBandwidth);
+		internal static extern IntPtr enet_host_create(ref ENetAddress address, IntPtr peerLimit, IntPtr channelLimit, uint incomingBandwidth, uint outgoingBandwidth, int bufferSize);
 
 		[DllImport(nativeLibrary, CallingConvention = CallingConvention.Cdecl)]
-		internal static extern IntPtr enet_host_create(IntPtr address, IntPtr peerLimit, IntPtr channelLimit, uint incomingBandwidth, uint outgoingBandwidth);
+		internal static extern IntPtr enet_host_create(IntPtr address, IntPtr peerLimit, IntPtr channelLimit, uint incomingBandwidth, uint outgoingBandwidth, int bufferSize);
 
 		[DllImport(nativeLibrary, CallingConvention = CallingConvention.Cdecl)]
 		internal static extern IntPtr enet_host_connect(IntPtr host, ref ENetAddress address, IntPtr channelCount, uint data);
@@ -1079,4 +1083,4 @@ namespace ENet {
 		[DllImport(nativeLibrary, CallingConvention = CallingConvention.Cdecl)]
 		internal static extern void enet_peer_reset(IntPtr peer);
 	}
-}
+}