Lower the amount of running tasks

This commit is contained in:
Bond_009
2019-02-24 03:16:19 +01:00
committed by Bond-009
parent 5024c52c60
commit 2696ac5eac
10 changed files with 53 additions and 81 deletions

View File

@@ -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;