aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/SocketSharp/WebSocketSharpRequest.cs
diff options
context:
space:
mode:
authorBond_009 <Bond.009@outlook.com>2019-02-24 03:16:19 +0100
committerBond-009 <bond.009@outlook.com>2019-03-25 21:33:48 +0100
commit2696ac5eacfb4702d629bc06a8b42b868c316116 (patch)
treeafbd4501aa7bc55a4c5b04d1e0e357ec7acebfa3 /Emby.Server.Implementations/SocketSharp/WebSocketSharpRequest.cs
parent5024c52c60617fffc09ee7b6eeabe0ac400bae75 (diff)
Lower the amount of running tasks
Diffstat (limited to 'Emby.Server.Implementations/SocketSharp/WebSocketSharpRequest.cs')
-rw-r--r--Emby.Server.Implementations/SocketSharp/WebSocketSharpRequest.cs39
1 files changed, 20 insertions, 19 deletions
diff --git a/Emby.Server.Implementations/SocketSharp/WebSocketSharpRequest.cs b/Emby.Server.Implementations/SocketSharp/WebSocketSharpRequest.cs
index e0a0ee286..6fdc6a3c8 100644
--- a/Emby.Server.Implementations/SocketSharp/WebSocketSharpRequest.cs
+++ b/Emby.Server.Implementations/SocketSharp/WebSocketSharpRequest.cs
@@ -3,8 +3,8 @@ using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Net;
+using System.Linq;
using System.Text;
-using MediaBrowser.Model.Services;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Extensions;
using Microsoft.Extensions.Logging;
@@ -474,27 +474,28 @@ namespace Emby.Server.Implementations.SocketSharp
{
get
{
- if (httpFiles == null)
+ if (httpFiles != null)
{
- if (files == null)
- {
- return httpFiles = Array.Empty<IHttpFile>();
- }
+ return httpFiles;
+ }
- httpFiles = new IHttpFile[files.Count];
- var i = 0;
- foreach (var pair in files)
+ if (files == null)
+ {
+ return httpFiles = Array.Empty<IHttpFile>();
+ }
+
+ var values = files.Values;
+ httpFiles = new IHttpFile[values.Count];
+ for (int i = 0; i < values.Count; i++)
+ {
+ var reqFile = values.ElementAt(i);
+ httpFiles[i] = new HttpFile
{
- var reqFile = pair.Value;
- httpFiles[i] = new HttpFile
- {
- ContentType = reqFile.ContentType,
- ContentLength = reqFile.ContentLength,
- FileName = reqFile.FileName,
- InputStream = reqFile.InputStream,
- };
- i++;
- }
+ ContentType = reqFile.ContentType,
+ ContentLength = reqFile.ContentLength,
+ FileName = reqFile.FileName,
+ InputStream = reqFile.InputStream,
+ };
}
return httpFiles;