diff --git a/Unhinged/Engine/UnhingedEngine.Worker.cs b/Unhinged/Engine/UnhingedEngine.Worker.cs index 3568c2d..2293dc1 100644 --- a/Unhinged/Engine/UnhingedEngine.Worker.cs +++ b/Unhinged/Engine/UnhingedEngine.Worker.cs @@ -239,11 +239,11 @@ private static unsafe void WorkerLoop(Worker W) } /// - /// Parses as many complete HTTP requests as are present in the receive buffer. + /// Parses as many complete HTTP requests as are present in the receiving buffer. /// For each complete request: /// - extracts the route /// - invokes the configured request handler to stage a response into WriteBuffer - /// The receive window is compacted when partial data remains. + /// The receiving window is compacted when partial data remains. /// Returns true if any response data was staged and should be flushed. /// private static async ValueTask TryParseRequests( @@ -275,6 +275,7 @@ private static async ValueTask TryParseRequests( await _sRequestHandler(connection); // Clear pooled dictionaries (query parameters + headers) + // Currently Clear won't reset the buffers, if it changes, adapt here too connection.Clear(); // Mark that there is data to flush (a request was fully processed) diff --git a/Unhinged/Engine/Worker.cs b/Unhinged/Engine/Worker.cs index d40339b..73f6aa3 100644 --- a/Unhinged/Engine/Worker.cs +++ b/Unhinged/Engine/Worker.cs @@ -131,9 +131,23 @@ public bool IsUsed(int index) public void Dispose() { - try { if (Ep >= 0) close(Ep); } catch { /* log */ } - try { if (NotifyEfd >= 0) close(NotifyEfd); } catch { /* log */ } - if (EventsBuf != IntPtr.Zero) Marshal.FreeHGlobal(EventsBuf); + try + { + if (Ep >= 0) + close(Ep); + + } catch { /* log */ } + + try + { + if (NotifyEfd >= 0) + close(NotifyEfd); + + } catch { /* log */ } + + if (EventsBuf != IntPtr.Zero) + Marshal.FreeHGlobal(EventsBuf); + // Optionally GC.SuppressFinalize(this); } } \ No newline at end of file