mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-22 04:43:04 +08:00
Execute disconnected handler in new task.
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
using System.Threading.Tasks;
|
||||
using MQTTnet.Diagnostics;
|
||||
|
||||
namespace MQTTnet.Internal
|
||||
{
|
||||
public static class TaskExtensions
|
||||
{
|
||||
public static void Forget(this Task task, IMqttNetChildLogger logger)
|
||||
{
|
||||
task?.ContinueWith(t =>
|
||||
{
|
||||
logger.Error(t.Exception, "Unhandled exception.");
|
||||
},
|
||||
TaskContinuationOptions.OnlyOnFaulted);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user