public ClientSession(IClientSocketWrapper client, HttpServer httpServer, HttpServerOptions options) { if (options == null) { throw new ArgumentNullException(nameof(options)); } _httpServer = httpServer ?? throw new ArgumentNullException(nameof(httpServer)); Client = client ?? throw new ArgumentNullException(nameof(client)); _sessionHandler = new HttpSessionHandler(this, options); }
private async Task HandleClientConnectionAsync(IClientSocketWrapper client) { using (var clientSession = new ClientSession(client, this, _options)) { try { await clientSession.RunAsync().ConfigureAwait(false); } catch (OperationCanceledException) { } catch (Exception exception) { HttpNetTrace.Error(nameof(HttpServer), exception, "Unhandled exception while handling cient connection."); } finally { HttpNetTrace.Information(nameof(HttpServer), "Client '{0}' disconnected.", client.Identifier); await client.DisconnectAsync(); } } }