mirror of
https://github.com/Radarr/Radarr.git
synced 2026-04-20 21:55:03 -04:00
Upgraded SignalR to 1.2.2
This commit is contained in:
@@ -3,7 +3,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Security.Cryptography;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNet.SignalR.Infrastructure;
|
||||
|
||||
@@ -11,6 +13,8 @@ namespace Microsoft.AspNet.SignalR.Messaging
|
||||
{
|
||||
internal class DefaultSubscription : Subscription
|
||||
{
|
||||
internal static string _defaultCursorPrefix = GetCursorPrefix();
|
||||
|
||||
private List<Cursor> _cursors;
|
||||
private List<Topic> _cursorTopics;
|
||||
|
||||
@@ -36,7 +40,7 @@ namespace Microsoft.AspNet.SignalR.Messaging
|
||||
else
|
||||
{
|
||||
// Ensure delegate continues to use the C# Compiler static delegate caching optimization.
|
||||
_cursors = Cursor.GetCursors(cursor, (k, s) => UnminifyCursor(k, s), stringMinifier) ?? GetCursorsFromEventKeys(EventKeys, topics);
|
||||
_cursors = Cursor.GetCursors(cursor, _defaultCursorPrefix, (k, s) => UnminifyCursor(k, s), stringMinifier) ?? GetCursorsFromEventKeys(EventKeys, topics);
|
||||
}
|
||||
|
||||
_cursorTopics = new List<Topic>();
|
||||
@@ -126,7 +130,7 @@ namespace Microsoft.AspNet.SignalR.Messaging
|
||||
{
|
||||
lock (_cursors)
|
||||
{
|
||||
Cursor.WriteCursors(textWriter, _cursors);
|
||||
Cursor.WriteCursors(textWriter, _cursors, _defaultCursorPrefix);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -196,6 +200,22 @@ namespace Microsoft.AspNet.SignalR.Messaging
|
||||
return list;
|
||||
}
|
||||
|
||||
private static string GetCursorPrefix()
|
||||
{
|
||||
using (var rng = new RNGCryptoServiceProvider())
|
||||
{
|
||||
var data = new byte[4];
|
||||
rng.GetBytes(data);
|
||||
|
||||
using (var writer = new StringWriter(CultureInfo.InvariantCulture))
|
||||
{
|
||||
var randomValue = (ulong)BitConverter.ToUInt32(data, 0);
|
||||
Cursor.WriteUlongAsHexToBuffer(randomValue, writer);
|
||||
return "d-" + writer.ToString() + "-";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static ulong GetMessageId(TopicLookup topics, string key)
|
||||
{
|
||||
Topic topic;
|
||||
|
||||
Reference in New Issue
Block a user