Prepare file reader loop
This commit is contained in:
parent
583ae506d2
commit
de5556faea
1 changed files with 7 additions and 3 deletions
|
|
@ -6,8 +6,6 @@ using nietras.SeparatedValues;
|
||||||
|
|
||||||
using pdns_dhcp.Options;
|
using pdns_dhcp.Options;
|
||||||
|
|
||||||
using Stl.Async;
|
|
||||||
|
|
||||||
namespace pdns_dhcp.Kea;
|
namespace pdns_dhcp.Kea;
|
||||||
|
|
||||||
public abstract class KeaDhcpLeaseWatcher : IHostedService
|
public abstract class KeaDhcpLeaseWatcher : IHostedService
|
||||||
|
|
@ -19,6 +17,7 @@ public abstract class KeaDhcpLeaseWatcher : IHostedService
|
||||||
Options = FileOptions.SequentialScan,
|
Options = FileOptions.SequentialScan,
|
||||||
Share = (FileShare)7,
|
Share = (FileShare)7,
|
||||||
};
|
};
|
||||||
|
|
||||||
private readonly FileSystemWatcher _fsw;
|
private readonly FileSystemWatcher _fsw;
|
||||||
private readonly string _leaseFile;
|
private readonly string _leaseFile;
|
||||||
private Channel<FileSystemEventArgs>? _eventChannel;
|
private Channel<FileSystemEventArgs>? _eventChannel;
|
||||||
|
|
@ -135,7 +134,12 @@ public abstract class KeaDhcpLeaseWatcher : IHostedService
|
||||||
{
|
{
|
||||||
try
|
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 { }
|
catch { }
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue