private async Task StopListener()
{
lock (this)
{
stopping = true;
}
if (stopLog != null)
{
await stopLog();
}
if (timer != null)
{
timer.Stop();
timer.Dispose();
timer = null;
}
dateTime = DateTime.MinValue;
if (cancellationTokenSource != null)
{
cancellationTokenSource.Cancel();
}
if (queueClient != null)
{
queueClient.Close();
queueClient = null;
}
if (subscriptionClient != null)
{
subscriptionClient.Close();
subscriptionClient = null;
}
lock (this)
{
stopping = false;
}
}