]> git.deb.at Git - rhonda/impostor.hazel.git/commitdiff
Removed some todos
authorJamJar00 <jamster.30@btinternet.com>
Sat, 14 May 2016 19:54:06 +0000 (20:54 +0100)
committerJamJar00 <jamster.30@btinternet.com>
Sat, 14 May 2016 19:54:06 +0000 (20:54 +0100)
Hazel/UdpClientConnection.cs
Hazel/UdpConnection.Reliable.cs
Hazel/UdpConnection.cs
Hazel/UdpConnectionListener.cs
Performance1.psess [new file with mode: 0644]

index 5194cc50d9a27705c33ea4c738dc1fb9ca18af87..dbf48204e5f058a9d65390fe9c8ba300afccf186 100644 (file)
@@ -99,11 +99,19 @@ namespace Hazel
 
                 State = ConnectionState.Connecting;
 
+                //Calculate local end point
+                EndPoint localEndPoint;
+                if (nep.EndPoint is IPEndPoint)
+                    localEndPoint = new IPEndPoint(((IPEndPoint)nep.EndPoint).Address, 0);
+                else if (nep.EndPoint is IPEndPoint)
+                    localEndPoint = new DnsEndPoint(((DnsEndPoint)nep.EndPoint).Host, 0);
+                else
+                    throw new ArgumentException("Can only connect using an IPEndPoint or DnsEndpoint");
+
                 //Begin listening
                 try
                 {
-                    //TODO should that really be IPAddress.Any?
-                    socket.Bind(new IPEndPoint(IPAddress.Any, 0));
+                    socket.Bind(localEndPoint);
                 }
                 catch (SocketException e)
                 {
@@ -179,7 +187,7 @@ namespace Hazel
             byte[] buffer = HandleReceive(dataBuffer, bytesReceived);
             SendOption sendOption = (SendOption)dataBuffer[0];
 
-            //TODO may possibly get better performance with above/below swapped and block copy added
+            //TODO may get better performance with Handle receive after and block copy call added
 
             //Begin receiving again
             try
index d69b3935322cc971e847af4e48e02f0ad7a701cd..da0245520a01c9791b4a4af7a34592e86a95c209 100644 (file)
@@ -9,7 +9,9 @@ using System.Threading.Tasks;
 namespace Hazel
 {
     partial class UdpConnection
-    {//TODO recycle dataevents and things?
+    {
+        //TODO recycle dataevents and things?
+        
         /// <summary>
         ///     The starting timeout, in miliseconds, at which data will be resent.
         /// </summary>
@@ -24,11 +26,6 @@ namespace Hazel
         /// </summary>
         volatile ushort lastIDAllocated;
 
-        /// <summary>
-        ///     The number of items to remember we have received before overwriting.
-        /// </summary>
-        private readonly int receiveCapacity = 4096;
-
         /// <summary>
         ///     The packets of data that have been transmitted reliably and not acknowledged.
         /// </summary>
@@ -136,9 +133,12 @@ namespace Hazel
             //Handle reliableness!
             lock (reliableDataPacketsMissing)
             {
+                //TODO Looping of IDs
+                //      Currently when ID loops all packets will be discarded as ID will be less than reliableReceiveLast
+                //      And wont be in reliableDataPacketsMissing.
+
                 //If the ID <= reliableReceiveLast it might be something we're missing
                 //HasReceivedSomething handles the edge case of reliableReceiveLast = 0 & ID = 0
-                //TODO Looping of IDs
                 if (id <= reliableReceiveLast && hasReceivedSomething)
                 {
                     //See if we're missing it, else this packet is a duplicate
index 69628ea353dcd7cfa39a802b893292647876ca37..4e880c0d6b2baa4ae21dcb6490b8dcdfe775606e 100644 (file)
@@ -71,7 +71,7 @@ namespace Hazel
             Buffer.BlockCopy(data, 0, bytes, bytes.Length - data.Length, data.Length);
 
             //Inform keepalive not to send for a while
-            ResetKeepAliveTimer();      //TODO keepalive tests
+            ResetKeepAliveTimer();
 
             //Write to connection
             WriteBytesToConnection(bytes);
index b03f160f4d34e2bbb5198abde690587cec41f4c3..da2c06b112262b59626c5a476e416f1b41ce59b5 100644 (file)
@@ -5,7 +5,7 @@ using System.Net;
 using System.Net.Sockets;
 using System.Text;
 using System.Threading.Tasks;
-//TODO complete trawl through for thread safety, everywhere
+
 /* 
 * Copyright (C) Jamie Read - All Rights Reserved
 * Unauthorized copying of this file, via any medium is strictly prohibited
diff --git a/Performance1.psess b/Performance1.psess
new file mode 100644 (file)
index 0000000..7dc9d39
--- /dev/null
@@ -0,0 +1,21 @@
+<VSPerformanceSession Version="1.00">
+  <Options>
+    <CollectionMethod>Sampling</CollectionMethod>
+    <AllocationMethod>None</AllocationMethod>
+    <AddReport>true</AddReport>
+    <UniqueReport>Timestamp</UniqueReport>
+    <SamplingMethod>Cycles</SamplingMethod>
+    <CycleCount>10000000</CycleCount>
+    <PageFaultCount>10</PageFaultCount>
+    <SysCallCount>10</SysCallCount>
+    <SamplingCounter PlatformID="00000000" CounterID="0000000000000000" ReloadValue="000000000000000a" />
+    <RelocateBinaries>false</RelocateBinaries>
+    <HardwareCounters EnableHWCounters="false" />
+  </Options>
+  <PreinstrumentEvent>
+    <InstrEventExclude>false</InstrEventExclude>
+  </PreinstrumentEvent>
+  <PostinstrumentEvent>
+    <InstrEventExclude>false</InstrEventExclude>
+  </PostinstrumentEvent>
+</VSPerformanceSession>