fixes #1218 - Dlna server doesn't work after resuming to sleep

This commit is contained in:
Luke Pulverenti 2015-11-14 14:41:49 -05:00
parent 02b828a0e2
commit 3eda14eff0

View File

@ -15,6 +15,7 @@ using System.Net.Sockets;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Win32;
namespace MediaBrowser.Dlna.Ssdp
{
@ -121,6 +122,15 @@ namespace MediaBrowser.Dlna.Ssdp
RestartSocketListener();
ReloadAliveNotifier();
SystemEvents.PowerModeChanged += SystemEvents_PowerModeChanged;
}
void SystemEvents_PowerModeChanged(object sender, PowerModeChangedEventArgs e)
{
if (e.Mode == PowerModes.Resume)
{
NotifyAll();
}
}
public void SendSearchMessage(EndPoint localIp)
@ -433,6 +443,7 @@ namespace MediaBrowser.Dlna.Ssdp
public void Dispose()
{
_config.NamedConfigurationUpdated -= _config_ConfigurationUpdated;
SystemEvents.PowerModeChanged -= SystemEvents_PowerModeChanged;
_isDisposed = true;
while (_messageQueue.Count != 0)