Skip to content

Commit

Permalink
attempt to resolve https hangs
Browse files Browse the repository at this point in the history
  • Loading branch information
LukePulverenti committed Mar 25, 2018
1 parent e026138 commit 9534093
Show file tree
Hide file tree
Showing 17 changed files with 768 additions and 742 deletions.
2 changes: 1 addition & 1 deletion Emby.Server.Implementations/ApplicationHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2217,7 +2217,7 @@ public async Task<CheckForUpdateResult> CheckForApplicationUpdate(CancellationTo
try
{
var result = await new GithubUpdater(HttpClient, JsonSerializer).CheckForUpdateResult("MediaBrowser",
"Emby",
"Emby.Releases",
ApplicationVersion,
updateLevel,
ReleaseAssetFilename,
Expand Down
47 changes: 1 addition & 46 deletions RSSDP/SsdpDevicePublisher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,6 @@ public void AddDevice(SsdpRootDevice device)
{
//_MinCacheTime = minCacheTime;

ConnectToDeviceEvents(device);

WriteTrace("Device Added", device);

SetRebroadcastAliveNotificationsTimer(minCacheTime);
Expand Down Expand Up @@ -152,8 +150,6 @@ public async Task RemoveDevice(SsdpRootDevice device)
{
//_MinCacheTime = minCacheTime;

DisconnectFromDeviceEvents(device);

WriteTrace("Device Removed", device);

await SendByeByeNotifications(device, true, CancellationToken.None).ConfigureAwait(false);
Expand Down Expand Up @@ -527,9 +523,8 @@ private Task SendByeByeNotification(SsdpDevice device, string notificationType,
var message = BuildMessage(header, values);

var sendCount = IsDisposed ? 1 : 3;
WriteTrace(String.Format("Sent byebye notification"), device);
return _CommsServer.SendMulticastMessage(message, sendCount, cancellationToken);

//WriteTrace(String.Format("Sent byebye notification"), device);
}

#endregion
Expand Down Expand Up @@ -630,50 +625,10 @@ private void WriteTrace(string text, SsdpDevice device)
WriteTrace(text + " " + device.DeviceType + " - " + device.Uuid);
}

private void ConnectToDeviceEvents(SsdpDevice device)
{
device.DeviceAdded += device_DeviceAdded;
device.DeviceRemoved += device_DeviceRemoved;

foreach (var childDevice in device.Devices)
{
ConnectToDeviceEvents(childDevice);
}
}

private void DisconnectFromDeviceEvents(SsdpDevice device)
{
device.DeviceAdded -= device_DeviceAdded;
device.DeviceRemoved -= device_DeviceRemoved;

foreach (var childDevice in device.Devices)
{
DisconnectFromDeviceEvents(childDevice);
}
}

#endregion

#region Event Handlers

private void device_DeviceAdded(object sender, DeviceEventArgs e)
{
if (IsDisposed)
{
return;
}

SendAliveNotifications(e.Device, false, CancellationToken.None);
ConnectToDeviceEvents(e.Device);
}

private void device_DeviceRemoved(object sender, DeviceEventArgs e)
{
var task = SendByeByeNotifications(e.Device, false, CancellationToken.None);
Task.WaitAll(task);
DisconnectFromDeviceEvents(e.Device);
}

private void CommsServer_RequestReceived(object sender, RequestReceivedEventArgs e)
{
if (this.IsDisposed) return;
Expand Down
2 changes: 1 addition & 1 deletion SharedVersion.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
using System.Reflection;

[assembly: AssemblyVersion("3.3.1.7")]
[assembly: AssemblyVersion("3.3.1.8")]
Loading

0 comments on commit 9534093

Please sign in to comment.