Skip to content
This repository has been archived by the owner on Jul 7, 2024. It is now read-only.

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
lyrise committed Jan 1, 2022
1 parent 3a9c47f commit dd62789
Show file tree
Hide file tree
Showing 27 changed files with 250 additions and 273 deletions.
50 changes: 16 additions & 34 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
@@ -1,36 +1,18 @@
{
"version": 1,
"isRoot": true,
"tools": {
"dotnet-format": {
"version": "5.1.250801",
"commands": [
"dotnet-format"
]
"isRoot": true,
"tools": {
"coverlet.console": {
"commands": ["coverlet"],
"version": "3.1.0"
},
"dotnet-reportgenerator-globaltool": {
"commands": ["reportgenerator"],
"version": "4.8.13"
},
"nukeeper": {
"commands": ["nukeeper"],
"version": "0.35.0"
}
},
"coverlet.console": {
"version": "3.1.0",
"commands": [
"coverlet"
]
},
"dotnet-reportgenerator-globaltool": {
"version": "4.8.13",
"commands": [
"reportgenerator"
]
},
"nukeeper": {
"version": "0.35.0",
"commands": [
"nukeeper"
]
},
"dotnet-t4": {
"version": "2.2.1",
"commands": [
"t4"
]
}
}
}
"version": 1
}
22 changes: 11 additions & 11 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "design ui-desktop (Win)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build (Omnius.Axis.Ui.Desktop)",
"program": "${workspaceFolder}/tmp/bin/win-vscode/Omnius.Axis.Ui.Desktop/Debug/net6.0/Omnius.Axis.Ui.Desktop.dll",
"args": ["-d", "true"],
"cwd": "${workspaceFolder}/demo/1",
"console": "internalConsole",
"stopAtEntry": false
},
{
"name": "daemon (Win)",
"type": "coreclr",
Expand Down Expand Up @@ -37,17 +48,6 @@
"console": "internalConsole",
"stopAtEntry": false
},
{
"name": "ui-desktop design (Win)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build (Omnius.Axis.Ui.Desktop)",
"program": "${workspaceFolder}/tmp/bin/win-vscode/Omnius.Axis.Ui.Desktop/Debug/net6.0/Omnius.Axis.Ui.Desktop.dll",
"args": ["-d", "true"],
"cwd": "${workspaceFolder}/demo/1",
"console": "internalConsole",
"stopAtEntry": false
},
{
"name": "daemon (Linux)",
"type": "coreclr",
Expand Down
4 changes: 2 additions & 2 deletions demo/run-2.ps1
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Start-Process -FilePath pwsh -ArgumentList ./3/run-daemon.ps1
Start-Process -FilePath pwsh -ArgumentList ./3/run-ui-desktop.ps1
Start-Process -FilePath pwsh -ArgumentList ./2/run-daemon.ps1
Start-Process -FilePath pwsh -ArgumentList ./2/run-ui-desktop.ps1
2 changes: 1 addition & 1 deletion refs/core
Submodule core updated from 15ef1c to 1272df
13 changes: 5 additions & 8 deletions rpfs/Omnius.Axis.Intaractors/Omnius.Axis.Intaractors.Models.rpf
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ message Profile {
}

message ProfileContent {
TrustedSignatures: vector<OmniSignature>(capacity: 32 * 1024),
BlockedSignatures: vector<OmniSignature>(capacity: 32 * 1024),
Seeds: vector<Seed>(capacity: 32 * 1024 * 1024),
TrustedSignatures: vector<OmniSignature>(capacity: 1024),
BlockedSignatures: vector<OmniSignature>(capacity: 1024),
Seeds: vector<Seed>(capacity: 256 * 1024),
}

message Seed {
Expand Down Expand Up @@ -45,14 +45,11 @@ message FileDownloaderConfig {

message ProfilePublisherConfig {
DigitalSignature: OmniDigitalSignature,
TrustedSignatures: vector<OmniSignature>(capacity: 32 * 1024),
BlockedSignatures: vector<OmniSignature>(capacity: 32 * 1024),
Seeds: vector<Seed>(capacity: 32 * 1024 * 1024),
}

message ProfileSubscriberConfig {
TrustedSignatures: vector<OmniSignature>(capacity: 32 * 1024),
BlockedSignatures: vector<OmniSignature>(capacity: 32 * 1024),
TrustedSignatures: vector<OmniSignature>(capacity: 1024),
BlockedSignatures: vector<OmniSignature>(capacity: 1024),
SearchDepth: uint32,
MaxProfileCount: uint32,
}
6 changes: 5 additions & 1 deletion src/Omnius.Axis.Daemon/NLog.config
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,16 @@
</attribute>
</layout>
</target>
<target
name="log_console"
xsi:type="Console"
layout="${longdate} [${threadid}] [${uppercase:${level}}] ${callsite}:${callsite-linenumber}${newline}${message}${newline}${exception:format=toString,StackTrace}" />
</targets>

<rules>
<logger
name="*"
minlevel="Info"
writeTo="log_file" />
writeTo="log_file,log_console" />
</rules>
</nlog>
27 changes: 14 additions & 13 deletions src/Omnius.Axis.Engines/Implementations/TcpConnectionAccepter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,14 @@ private async ValueTask<OmniAddress[]> InternalGetListenEndpointsAsync(Cancellat

var globalIpAddresses = await this.GetMyGlobalIpAddressesAsync(cancellationToken);

if (listenIpAddress.AddressFamily == AddressFamily.InterNetwork && listenIpAddress == IPAddress.Any)
if (listenIpAddress.AddressFamily == AddressFamily.InterNetwork)
{
foreach (var globalIpAddress in globalIpAddresses.Where(n => n.AddressFamily == AddressFamily.InterNetwork))
{
results.Add(OmniAddress.CreateTcpEndpoint(globalIpAddress, port));
}
}
else if (listenIpAddress.AddressFamily == AddressFamily.InterNetworkV6 && listenIpAddress == IPAddress.IPv6Any)
else if (listenIpAddress.AddressFamily == AddressFamily.InterNetworkV6)
{
foreach (var globalIpAddress in globalIpAddresses.Where(n => n.AddressFamily == AddressFamily.InterNetworkV6))
{
Expand All @@ -127,9 +127,9 @@ public async ValueTask<IEnumerable<IPAddress>> GetMyGlobalIpAddressesAsync(Cance
{
var list = new HashSet<IPAddress>();

try
if (_options.UseUpnp)
{
if (_options.UseUpnp)
try
{
using var upnpClient = _upnpClientFactory.Create();
await upnpClient.ConnectAsync(cancellationToken);
Expand All @@ -140,21 +140,22 @@ public async ValueTask<IEnumerable<IPAddress>> GetMyGlobalIpAddressesAsync(Cance
list.Add(externalIp);
}
}

foreach (var ipAddress in Dns.GetHostAddresses(Dns.GetHostName()))
catch (Exception e)
{
#if !DEBUG
if (!Internal.IpAddressHelper.IsGlobalIpAddress(ipAddress)) continue;
#endif

list.Add(ipAddress);
_logger.Error(e);
}
}
catch (Exception e)

foreach (var ipAddress in Dns.GetHostAddresses(Dns.GetHostName()))
{
_logger.Error(e);
if (!Internal.IpAddressHelper.IsGlobalIpAddress(ipAddress)) continue;
list.Add(ipAddress);
}

#if DEBUG
list.Add(IPAddress.Loopback);
#endif

return list;
}
}
45 changes: 0 additions & 45 deletions src/Omnius.Axis.Intaractors/Implementations/Dashboard.cs

This file was deleted.

24 changes: 11 additions & 13 deletions src/Omnius.Axis.Intaractors/Implementations/FileDownloader.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
using Omnius.Axis.Intaractors.Internal;
using Omnius.Axis.Intaractors.Internal.Models;
using Omnius.Axis.Intaractors.Internal.Repositories;
using Omnius.Axis.Intaractors.Models;
using Omnius.Axis.Models;
using Omnius.Axis.Remoting;
using Omnius.Core;
using Omnius.Core.Helpers;
using Omnius.Core.Storages;
Expand All @@ -14,7 +12,7 @@ public sealed class FileDownloader : AsyncDisposableBase, IFileDownloader
{
private static readonly NLog.Logger _logger = NLog.LogManager.GetCurrentClassLogger();

private readonly AxisServiceAdapter _service;
private readonly IServiceAdapter _serviceAdapter;
private readonly IKeyValueStorageFactory _keyValueStorageFactory;
private readonly IBytesPool _bytesPool;
private readonly FileDownloaderOptions _options;
Expand All @@ -30,16 +28,16 @@ public sealed class FileDownloader : AsyncDisposableBase, IFileDownloader

private const string Registrant = "Omnius.Axis.Intaractors.FileDownloader";

public static async ValueTask<FileDownloader> CreateAsync(IAxisService axisService, ISingleValueStorageFactory singleValueStorageFactory, IKeyValueStorageFactory keyValueStorageFactory, IBytesPool bytesPool, FileDownloaderOptions options, CancellationToken cancellationToken = default)
public static async ValueTask<FileDownloader> CreateAsync(IServiceAdapter serviceAdapter, ISingleValueStorageFactory singleValueStorageFactory, IKeyValueStorageFactory keyValueStorageFactory, IBytesPool bytesPool, FileDownloaderOptions options, CancellationToken cancellationToken = default)
{
var fileDownloader = new FileDownloader(axisService, singleValueStorageFactory, keyValueStorageFactory, bytesPool, options);
var fileDownloader = new FileDownloader(serviceAdapter, singleValueStorageFactory, keyValueStorageFactory, bytesPool, options);
await fileDownloader.InitAsync(cancellationToken);
return fileDownloader;
}

private FileDownloader(IAxisService axisService, ISingleValueStorageFactory singleValueStorageFactory, IKeyValueStorageFactory keyValueStorageFactory, IBytesPool bytesPool, FileDownloaderOptions options)
private FileDownloader(IServiceAdapter service, ISingleValueStorageFactory singleValueStorageFactory, IKeyValueStorageFactory keyValueStorageFactory, IBytesPool bytesPool, FileDownloaderOptions options)
{
_service = new AxisServiceAdapter(axisService);
_serviceAdapter = service;
_keyValueStorageFactory = keyValueStorageFactory;
_bytesPool = bytesPool;
_options = options;
Expand Down Expand Up @@ -92,19 +90,19 @@ private async ValueTask SyncSubscribedFiles(CancellationToken cancellationToken
{
using (await _asyncLock.LockAsync(cancellationToken))
{
var reports = await _service.GetSubscribedFileReportsAsync(cancellationToken);
var reports = await _serviceAdapter.GetSubscribedFileReportsAsync(cancellationToken);
var hashes = reports.Where(n => n.Registrant == Registrant).Select(n => n.RootHash).ToHashSet();

foreach (var hash in hashes)
{
if (_fileDownloaderRepo.Items.Exists(hash)) continue;
await _service.UnsubscribeFileAsync(hash, Registrant, cancellationToken);
await _serviceAdapter.UnsubscribeFileAsync(hash, Registrant, cancellationToken);
}

foreach (var seed in _fileDownloaderRepo.Items.FindAll().Select(n => n.Seed))
{
if (hashes.Contains(seed.RootHash)) continue;
await _service.SubscribeFileAsync(seed.RootHash, Registrant, cancellationToken);
await _serviceAdapter.SubscribeFileAsync(seed.RootHash, Registrant, cancellationToken);
}
}
}
Expand All @@ -116,7 +114,7 @@ private async ValueTask TryExportSubscribedFiles(CancellationToken cancellationT
var config = await this.GetConfigAsync(cancellationToken);
var basePath = config.DestinationDirectory;

var reports = (await _service.GetSubscribedFileReportsAsync(cancellationToken))
var reports = (await _serviceAdapter.GetSubscribedFileReportsAsync(cancellationToken))
.Where(n => n.Registrant == Registrant)
.ToDictionary(n => n.RootHash);

Expand All @@ -130,7 +128,7 @@ private async ValueTask TryExportSubscribedFiles(CancellationToken cancellationT
DirectoryHelper.CreateDirectory(basePath);
var filePath = Path.Combine(basePath, item.Seed.Name);

if (await _service.TryExportFileToStorageAsync(item.Seed.RootHash, filePath, cancellationToken))
if (await _serviceAdapter.TryExportFileToStorageAsync(item.Seed.RootHash, filePath, cancellationToken))
{
var newItem = new DownloadingFileItem(item.Seed, filePath, item.CreationTime, DownloadingFileState.Completed);
_fileDownloaderRepo.Items.Upsert(newItem);
Expand All @@ -145,7 +143,7 @@ public async ValueTask<IEnumerable<DownloadingFileReport>> GetDownloadingFileRep
{
var results = new List<DownloadingFileReport>();

var reports = (await _service.GetSubscribedFileReportsAsync(cancellationToken))
var reports = (await _serviceAdapter.GetSubscribedFileReportsAsync(cancellationToken))
.Where(n => n.Registrant == Registrant)
.ToDictionary(n => n.RootHash);

Expand Down
Loading

0 comments on commit dd62789

Please sign in to comment.