From de5556faea202bf3c600aa8a091785857de927de Mon Sep 17 00:00:00 2001 From: AliveDevil Date: Sun, 26 Nov 2023 02:10:01 +0100 Subject: [PATCH] Prepare file reader loop --- src/pdns-dhcp/Kea/KeaLeaseWatcher.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/pdns-dhcp/Kea/KeaLeaseWatcher.cs b/src/pdns-dhcp/Kea/KeaLeaseWatcher.cs index cd01ec4..e89f6f2 100644 --- a/src/pdns-dhcp/Kea/KeaLeaseWatcher.cs +++ b/src/pdns-dhcp/Kea/KeaLeaseWatcher.cs @@ -6,8 +6,6 @@ using nietras.SeparatedValues; using pdns_dhcp.Options; -using Stl.Async; - namespace pdns_dhcp.Kea; public abstract class KeaDhcpLeaseWatcher : IHostedService @@ -19,6 +17,7 @@ public abstract class KeaDhcpLeaseWatcher : IHostedService Options = FileOptions.SequentialScan, Share = (FileShare)7, }; + private readonly FileSystemWatcher _fsw; private readonly string _leaseFile; private Channel? _eventChannel; @@ -135,7 +134,12 @@ public abstract class KeaDhcpLeaseWatcher : IHostedService { try { - using var fileStream = new FileStream(Options.Leases, _leaseFileStreamOptions); + using var streamReader = new StreamReader(Options.Leases, _leaseFileStreamOptions); + using var reader = Sep.Reader().From(streamReader); + + while (!stoppingToken.IsCancellationRequested) + { + } } catch { } }