Minor cleanup
This commit is contained in:
parent
b865716841
commit
357f5f85bb
|
|
@ -2,7 +2,7 @@
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace SocialWeather
|
namespace SocialWeather.Json
|
||||||
{
|
{
|
||||||
public class JsonStreamFormatter<T> : IStreamFormatter<T>
|
public class JsonStreamFormatter<T> : IStreamFormatter<T>
|
||||||
{
|
{
|
||||||
|
|
@ -10,8 +10,6 @@ namespace SocialWeather
|
||||||
private readonly PersistentConnectionLifeTimeManager _lifetimeManager;
|
private readonly PersistentConnectionLifeTimeManager _lifetimeManager;
|
||||||
private readonly FormatterResolver _formatterResolver;
|
private readonly FormatterResolver _formatterResolver;
|
||||||
private readonly ILogger<SocialWeatherEndPoint> _logger;
|
private readonly ILogger<SocialWeatherEndPoint> _logger;
|
||||||
private object _lockObj = new object();
|
|
||||||
private WeatherReport _lastWeatherReport;
|
|
||||||
|
|
||||||
public SocialWeatherEndPoint(PersistentConnectionLifeTimeManager lifetimeManager,
|
public SocialWeatherEndPoint(PersistentConnectionLifeTimeManager lifetimeManager,
|
||||||
FormatterResolver formatterResolver, ILogger<SocialWeatherEndPoint> logger)
|
FormatterResolver formatterResolver, ILogger<SocialWeatherEndPoint> logger)
|
||||||
|
|
@ -37,10 +35,6 @@ namespace SocialWeather
|
||||||
WeatherReport weatherReport;
|
WeatherReport weatherReport;
|
||||||
while ((weatherReport = await formatter.ReadAsync(stream)) != null)
|
while ((weatherReport = await formatter.ReadAsync(stream)) != null)
|
||||||
{
|
{
|
||||||
lock(_lockObj)
|
|
||||||
{
|
|
||||||
_lastWeatherReport = weatherReport;
|
|
||||||
}
|
|
||||||
await _lifetimeManager.SendToAllAsync(weatherReport);
|
await _lifetimeManager.SendToAllAsync(weatherReport);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
using Microsoft.AspNetCore.Builder;
|
using Microsoft.AspNetCore.Builder;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.AspNetCore.Http;
|
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using SocialWeather.Json;
|
||||||
using SocialWeather.Pipe;
|
using SocialWeather.Pipe;
|
||||||
using SocialWeather.Protobuf;
|
using SocialWeather.Protobuf;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue