pull/1/head
Ogoun 5 years ago
parent a064b5972d
commit 9e6cc90656

@ -25,10 +25,17 @@ namespace ZeroLevel.Network
socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ExclusiveAddressUse, false); socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ExclusiveAddressUse, false);
try try
{ {
socket.Connect(endpoint); IAsyncResult result = socket.BeginConnect(endpoint, null, null);
socket.Shutdown(SocketShutdown.Both); bool success = result.AsyncWaitHandle.WaitOne(100, true);
socket.Close(); if (socket.Connected)
return true; {
socket.EndConnect(result);
return true;
}
else
{
socket.Close();
}
} }
catch catch
{ {

@ -42,7 +42,15 @@ namespace ZeroLevel.Services.Shedulling
} }
if (result != null) if (result != null)
{ {
Task.Run(() => result.Callback(result.Key)).ContinueWith(t => try
{
result.Callback(result.Key);
}
catch (Exception ex)
{
Log.SystemError(ex, $"Fault task '{result.Key}' on expiration date '{result.ExpirationDate.ToString("yyyy-MM-dd HH:mm:ss fff}")}'");
}
/*Task.Run(() => result.Callback(result.Key)).ContinueWith(t =>
{ {
if (t.IsFaulted) if (t.IsFaulted)
{ {
@ -51,7 +59,7 @@ namespace ZeroLevel.Services.Shedulling
ex = ex.InnerException; ex = ex.InnerException;
Log.SystemError(ex, $"Fault task '{result.Key}' on expiration date '{result.ExpirationDate.ToString("yyyy-MM-dd HH:mm:ss fff}")}'"); Log.SystemError(ex, $"Fault task '{result.Key}' on expiration date '{result.ExpirationDate.ToString("yyyy-MM-dd HH:mm:ss fff}")}'");
} }
}); });*/
} }
} }

@ -16,14 +16,23 @@
<RepositoryType>GitHub</RepositoryType> <RepositoryType>GitHub</RepositoryType>
<Version>3.0.9</Version> <Version>3.0.9</Version>
<FileVersion>3.0.0.9</FileVersion> <FileVersion>3.0.0.9</FileVersion>
<Platforms>AnyCPU;x64</Platforms>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
</Project> </Project>

Loading…
Cancel
Save

Powered by TurnKey Linux.