aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Jellyfin.Server/Jellyfin.Server.csproj5
-rw-r--r--MediaBrowser.Controller/Entities/BaseItem.cs2
-rw-r--r--MediaBrowser.Controller/Entities/Folder.cs7
-rw-r--r--Mono.Nat/Upnp/Searchers/UpnpSearcher.cs6
-rw-r--r--SocketHttpListener/HttpBase.cs18
-rw-r--r--SocketHttpListener/HttpResponse.cs4
-rw-r--r--SocketHttpListener/Net/HttpConnection.cs9
-rw-r--r--SocketHttpListener/WebSocket.cs9
-rw-r--r--jellyfin.ruleset13
9 files changed, 21 insertions, 52 deletions
diff --git a/Jellyfin.Server/Jellyfin.Server.csproj b/Jellyfin.Server/Jellyfin.Server.csproj
index 897d93339..0622d94b8 100644
--- a/Jellyfin.Server/Jellyfin.Server.csproj
+++ b/Jellyfin.Server/Jellyfin.Server.csproj
@@ -27,6 +27,11 @@
<PackageReference Include="SerilogAnalyzer" Version="0.15.0" />
</ItemGroup>
+ <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
+ <RunCodeAnalysis>true</RunCodeAnalysis>
+ <CodeAnalysisRuleSet>../jellyfin.ruleset</CodeAnalysisRuleSet>
+ </PropertyGroup>
+
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.2.0" />
diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs
index d313848fe..5534576f1 100644
--- a/MediaBrowser.Controller/Entities/BaseItem.cs
+++ b/MediaBrowser.Controller/Entities/BaseItem.cs
@@ -357,7 +357,7 @@ namespace MediaBrowser.Controller.Entities
{
var list = new List<Tuple<StringBuilder, bool>>();
- int thisMarker = 0, thisNumericChunk = 0;
+ int thisMarker = 0;
while (thisMarker < s1.Length)
{
diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.cs
index 2103e0045..dab96509c 100644
--- a/MediaBrowser.Controller/Entities/Folder.cs
+++ b/MediaBrowser.Controller/Entities/Folder.cs
@@ -644,12 +644,9 @@ namespace MediaBrowser.Controller.Entities
return PostFilterAndSort(items, query, true);
}
- if (!(this is UserRootFolder) && !(this is AggregateFolder))
+ if (!(this is UserRootFolder) && !(this is AggregateFolder) && query.ParentId == Guid.Empty)
{
- if (!query.ParentId.Equals(Guid.Empty))
- {
- query.Parent = this;
- }
+ query.Parent = this;
}
if (RequiresPostFiltering2(query))
diff --git a/Mono.Nat/Upnp/Searchers/UpnpSearcher.cs b/Mono.Nat/Upnp/Searchers/UpnpSearcher.cs
index b70768b6f..3b54c4680 100644
--- a/Mono.Nat/Upnp/Searchers/UpnpSearcher.cs
+++ b/Mono.Nat/Upnp/Searchers/UpnpSearcher.cs
@@ -47,7 +47,6 @@ namespace Mono.Nat
{
public event EventHandler<DeviceEventArgs> DeviceFound;
- private DateTime nextSearch;
private readonly ILogger _logger;
private readonly IHttpClient _httpClient;
@@ -98,11 +97,6 @@ namespace Mono.Nat
{
}
- public DateTime NextSearch
- {
- get { return nextSearch; }
- }
-
private void OnDeviceFound(DeviceEventArgs args)
{
if (DeviceFound != null)
diff --git a/SocketHttpListener/HttpBase.cs b/SocketHttpListener/HttpBase.cs
index fea91d84b..c386b9374 100644
--- a/SocketHttpListener/HttpBase.cs
+++ b/SocketHttpListener/HttpBase.cs
@@ -13,12 +13,6 @@ namespace SocketHttpListener
#endregion
- #region Internal Fields
-
- internal byte[] EntityBodyData;
-
- #endregion
-
#region Protected Fields
protected const string CrLf = "\r\n";
@@ -37,18 +31,6 @@ namespace SocketHttpListener
#region Public Properties
- public string EntityBody
- {
- get
- {
- var data = EntityBodyData;
-
- return data != null && data.Length > 0
- ? getEncoding(_headers["Content-Type"]).GetString(data, 0, data.Length)
- : string.Empty;
- }
- }
-
public QueryParamCollection Headers => _headers;
public Version ProtocolVersion => _version;
diff --git a/SocketHttpListener/HttpResponse.cs b/SocketHttpListener/HttpResponse.cs
index bcfa4a906..d5d9b4a1c 100644
--- a/SocketHttpListener/HttpResponse.cs
+++ b/SocketHttpListener/HttpResponse.cs
@@ -115,10 +115,6 @@ namespace SocketHttpListener
output.Append(CrLf);
- var entity = EntityBody;
- if (entity.Length > 0)
- output.Append(entity);
-
return output.ToString();
}
diff --git a/SocketHttpListener/Net/HttpConnection.cs b/SocketHttpListener/Net/HttpConnection.cs
index f11cb0725..e89f4ed9b 100644
--- a/SocketHttpListener/Net/HttpConnection.cs
+++ b/SocketHttpListener/Net/HttpConnection.cs
@@ -32,8 +32,6 @@ namespace SocketHttpListener.Net
int _reuses;
bool _contextBound;
bool secure;
- int _timeout = 90000; // 90k ms for first request, 15k ms from then on
- private Timer _timer;
IPEndPoint local_ep;
HttpListener _lastListener;
X509Certificate cert;
@@ -91,8 +89,6 @@ namespace SocketHttpListener.Net
public async Task Init()
{
- _timer = new Timer(OnTimeout, null, Timeout.Infinite, Timeout.Infinite);
-
if (ssl_stream != null)
{
var enableAsync = true;
@@ -162,14 +158,10 @@ namespace SocketHttpListener.Net
_buffer = new byte[BufferSize];
try
{
- if (_reuses == 1)
- _timeout = 15000;
- //_timer.Change(_timeout, Timeout.Infinite);
_stream.BeginRead(_buffer, 0, BufferSize, s_onreadCallback, this);
}
catch
{
- //_timer.Change(Timeout.Infinite, Timeout.Infinite);
CloseSocket();
Unbind();
}
@@ -216,7 +208,6 @@ namespace SocketHttpListener.Net
private void OnReadInternal(IAsyncResult ares)
{
- //_timer.Change(Timeout.Infinite, Timeout.Infinite);
int nread = -1;
try
{
diff --git a/SocketHttpListener/WebSocket.cs b/SocketHttpListener/WebSocket.cs
index bf400599d..128bc8b97 100644
--- a/SocketHttpListener/WebSocket.cs
+++ b/SocketHttpListener/WebSocket.cs
@@ -24,7 +24,6 @@ namespace SocketHttpListener
{
#region Private Fields
- private string _base64Key;
private Action _closeContext;
private CompressionMethod _compression;
private WebSocketContext _context;
@@ -35,20 +34,12 @@ namespace SocketHttpListener
private object _forMessageEventQueue;
private object _forSend;
private const string _guid = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11";
- private Func<WebSocketContext, string>
- _handshakeRequestChecker;
private Queue<MessageEventArgs> _messageEventQueue;
- private uint _nonceCount;
- private string _origin;
- private bool _preAuth;
private string _protocol;
- private string[] _protocols;
- private Uri _proxyUri;
private volatile WebSocketState _readyState;
private AutoResetEvent _receivePong;
private bool _secure;
private Stream _stream;
- private Uri _uri;
private const string _version = "13";
#endregion
diff --git a/jellyfin.ruleset b/jellyfin.ruleset
new file mode 100644
index 000000000..0f8c9aa02
--- /dev/null
+++ b/jellyfin.ruleset
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RuleSet Name="Rules for Jellyfin.Server" Description="Code analysis rules for Jellyfin.Server.csproj" ToolsVersion="14.0">
+ <Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers">
+ <!-- disable warning SA1101: Prefix local calls with 'this.' -->
+ <Rule Id="SA1101" Action="None" />
+ <!-- disable warning SA1200: 'using' directive must appear within a namespace declaration -->
+ <Rule Id="SA1200" Action="None" />
+ <!-- disable warning SA1309: Fields must not begin with an underscore -->
+ <Rule Id="SA1309" Action="None" />
+ <!-- disable warning SA1633: The file header is missing or not located at the top of the file -->
+ <Rule Id="SA1633" Action="None" />
+ </Rules>
+</RuleSet>