diff --git a/Source/AsyncIO/Windows/CompletionPort.cs b/Source/AsyncIO/Windows/CompletionPort.cs index a4ad049..0a4e632 100644 --- a/Source/AsyncIO/Windows/CompletionPort.cs +++ b/Source/AsyncIO/Windows/CompletionPort.cs @@ -85,8 +85,8 @@ internal void PostCompletionStatus(IntPtr overlapped) public override bool GetMultipleQueuedCompletionStatus(int timeout, CompletionStatus[] completionStatuses, out int removed) { - // Windows XP Has NO GetQueuedCompletionStatusEx - // so we need dequeue IOPC one by one + // Windows XP has NO GetQueuedCompletionStatusEx + // so we need dequeue IOCP one by one #if NETSTANDARD1_3 if (false) { diff --git a/Source/AsyncIO/Windows/Overlapped.cs b/Source/AsyncIO/Windows/Overlapped.cs index fdb4045..2cea220 100644 --- a/Source/AsyncIO/Windows/Overlapped.cs +++ b/Source/AsyncIO/Windows/Overlapped.cs @@ -11,7 +11,7 @@ class Overlapped : IDisposable private static readonly int OffsetOffset = IntPtr.Size * 2; private static readonly int EventOffset = IntPtr.Size * 2 + sizeof(int) * 2; - private static readonly int MangerOverlappedOffset = IntPtr.Size * 3 + sizeof(int) * 2; + private static readonly int ManagedOverlappedOffset = IntPtr.Size * 3 + sizeof(int) * 2; private IntPtr m_address; private GCHandle m_handle; @@ -29,7 +29,7 @@ public Overlapped(Windows.Socket asyncSocket) m_handle = GCHandle.Alloc(this, GCHandleType.Normal); - Marshal.WriteIntPtr(m_address, MangerOverlappedOffset, GCHandle.ToIntPtr(m_handle)); + Marshal.WriteIntPtr(m_address, ManagedOverlappedOffset, GCHandle.ToIntPtr(m_handle)); } public void Dispose() @@ -78,7 +78,7 @@ public void StartOperation(OperationType operationType) public static Overlapped CompleteOperation(IntPtr overlappedAddress) { - IntPtr managedOverlapped = Marshal.ReadIntPtr(overlappedAddress, MangerOverlappedOffset); + IntPtr managedOverlapped = Marshal.ReadIntPtr(overlappedAddress, ManagedOverlappedOffset); GCHandle handle = GCHandle.FromIntPtr(managedOverlapped); diff --git a/Source/AsyncIO/Windows/Socket.cs b/Source/AsyncIO/Windows/Socket.cs index 927de84..9d2af12 100644 --- a/Source/AsyncIO/Windows/Socket.cs +++ b/Source/AsyncIO/Windows/Socket.cs @@ -506,9 +506,9 @@ public void AcceptInternal(AsyncSocket socket) { if (m_acceptSocketBufferAddress == IntPtr.Zero) { - m_acceptSocketBufferSize = (m_boundAddress.Size + 16) * 2; + m_acceptSocketBufferSize = m_boundAddress.Size + 16; - m_acceptSocketBufferAddress = Marshal.AllocHGlobal(m_acceptSocketBufferSize); + m_acceptSocketBufferAddress = Marshal.AllocHGlobal(m_acceptSocketBufferSize << 1); } int bytesReceived; @@ -518,8 +518,8 @@ public void AcceptInternal(AsyncSocket socket) m_inOverlapped.StartOperation(OperationType.Accept); if (!m_acceptEx(Handle, m_acceptSocket.Handle, m_acceptSocketBufferAddress, 0, - m_acceptSocketBufferSize / 2, - m_acceptSocketBufferSize / 2, out bytesReceived, m_inOverlapped.Address)) + m_acceptSocketBufferSize, + m_acceptSocketBufferSize, out bytesReceived, m_inOverlapped.Address)) { var socketError = (SocketError)Marshal.GetLastWin32Error(); diff --git a/Source/AsyncIO/Windows/UnsafeMethods.cs b/Source/AsyncIO/Windows/UnsafeMethods.cs index 24a8d1e..84390d4 100644 --- a/Source/AsyncIO/Windows/UnsafeMethods.cs +++ b/Source/AsyncIO/Windows/UnsafeMethods.cs @@ -97,7 +97,7 @@ public static extern bool GetQueuedCompletionStatus(IntPtr completionPort, out i [DllImport("kernel32.dll", SetLastError = true)] public static extern bool GetQueuedCompletionStatusEx(IntPtr completionPort, IntPtr completionPortEntries, - int count, out int removoed, int milliseconds, bool alertable); + int count, out int removed, int milliseconds, bool alertable); [DllImport("kernel32.dll", SetLastError = true)] public static extern bool PostQueuedCompletionStatus(IntPtr completionPort, int numberOfBytesTransferred,