mirror of
https://github.com/2dust/v2rayN.git
synced 2026-11-10 14:35:00 +03:00
AI-optimized code
This commit is contained in:
@@ -15,7 +15,7 @@ namespace ServiceLib.Handler
|
|||||||
|
|
||||||
public static async Task Start(string configPath, int httpPort, int pacPort)
|
public static async Task Start(string configPath, int httpPort, int pacPort)
|
||||||
{
|
{
|
||||||
_needRestart = (configPath != _configPath || httpPort != _httpPort || pacPort != _pacPort || !_isRunning);
|
_needRestart = configPath != _configPath || httpPort != _httpPort || pacPort != _pacPort || !_isRunning;
|
||||||
|
|
||||||
_configPath = configPath;
|
_configPath = configPath;
|
||||||
_httpPort = httpPort;
|
_httpPort = httpPort;
|
||||||
@@ -70,7 +70,7 @@ namespace ServiceLib.Handler
|
|||||||
}
|
}
|
||||||
|
|
||||||
var client = await _tcpListener.AcceptTcpClientAsync();
|
var client = await _tcpListener.AcceptTcpClientAsync();
|
||||||
await Task.Run(() => { WriteContent(client); });
|
await Task.Run(() => WriteContent(client));
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
@@ -90,7 +90,9 @@ namespace ServiceLib.Handler
|
|||||||
public static void Stop()
|
public static void Stop()
|
||||||
{
|
{
|
||||||
if (_tcpListener == null)
|
if (_tcpListener == null)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_isRunning = false;
|
_isRunning = false;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ namespace ServiceLib.Handler
|
|||||||
private static readonly Lazy<WebDavHandler> _instance = new(() => new());
|
private static readonly Lazy<WebDavHandler> _instance = new(() => new());
|
||||||
public static WebDavHandler Instance => _instance.Value;
|
public static WebDavHandler Instance => _instance.Value;
|
||||||
|
|
||||||
private Config? _config;
|
private readonly Config? _config;
|
||||||
private WebDavClient? _client;
|
private WebDavClient? _client;
|
||||||
private string? _lastDescription;
|
private string? _lastDescription;
|
||||||
private string _webDir = Global.AppName + "_backup";
|
private string _webDir = Global.AppName + "_backup";
|
||||||
@@ -62,7 +62,9 @@ namespace ServiceLib.Handler
|
|||||||
private async Task<bool> TryCreateDir()
|
private async Task<bool> TryCreateDir()
|
||||||
{
|
{
|
||||||
if (_client is null)
|
if (_client is null)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var result2 = await _client.Mkcol(_webDir);
|
var result2 = await _client.Mkcol(_webDir);
|
||||||
|
|||||||
Reference in New Issue
Block a user