Use TaskCache class from Microsoft.Extensions.TaskCache.Sources (#705)
Instead of Task.FromResult(0)
This commit is contained in:
parent
22e5dfd8df
commit
18f08fdb2f
|
|
@ -4,6 +4,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.Extensions.Internal;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Http
|
namespace Microsoft.AspNetCore.Http
|
||||||
{
|
{
|
||||||
|
|
@ -16,7 +17,7 @@ namespace Microsoft.AspNetCore.Http
|
||||||
private static readonly Func<object, Task> _disposeDelegate = disposable =>
|
private static readonly Func<object, Task> _disposeDelegate = disposable =>
|
||||||
{
|
{
|
||||||
((IDisposable)disposable).Dispose();
|
((IDisposable)disposable).Dispose();
|
||||||
return Task.FromResult(0);
|
return TaskCache.CompletedTask;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,10 @@
|
||||||
"type": "build",
|
"type": "build",
|
||||||
"version": "1.1.0-*"
|
"version": "1.1.0-*"
|
||||||
},
|
},
|
||||||
|
"Microsoft.Extensions.TaskCache.Sources": {
|
||||||
|
"version": "1.1.0-*",
|
||||||
|
"type": "build"
|
||||||
|
},
|
||||||
"System.Text.Encodings.Web": "4.0.0-*"
|
"System.Text.Encodings.Web": "4.0.0-*"
|
||||||
},
|
},
|
||||||
"frameworks": {
|
"frameworks": {
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,10 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Http.Features;
|
using Microsoft.AspNetCore.Http.Features;
|
||||||
using Microsoft.AspNetCore.Http.Internal;
|
using Microsoft.AspNetCore.Http.Internal;
|
||||||
|
using Microsoft.Extensions.Internal;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Builder.Internal
|
namespace Microsoft.AspNetCore.Builder.Internal
|
||||||
{
|
{
|
||||||
|
|
@ -81,7 +81,7 @@ namespace Microsoft.AspNetCore.Builder.Internal
|
||||||
RequestDelegate app = context =>
|
RequestDelegate app = context =>
|
||||||
{
|
{
|
||||||
context.Response.StatusCode = 404;
|
context.Response.StatusCode = 404;
|
||||||
return Task.FromResult(0);
|
return TaskCache.CompletedTask;
|
||||||
};
|
};
|
||||||
|
|
||||||
foreach (var component in _components.Reverse())
|
foreach (var component in _components.Reverse())
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,10 @@
|
||||||
"Microsoft.AspNetCore.WebUtilities": "1.1.0-*",
|
"Microsoft.AspNetCore.WebUtilities": "1.1.0-*",
|
||||||
"Microsoft.Extensions.ObjectPool": "1.1.0-*",
|
"Microsoft.Extensions.ObjectPool": "1.1.0-*",
|
||||||
"Microsoft.Extensions.Options": "1.1.0-*",
|
"Microsoft.Extensions.Options": "1.1.0-*",
|
||||||
|
"Microsoft.Extensions.TaskCache.Sources": {
|
||||||
|
"version": "1.1.0-*",
|
||||||
|
"type": "build"
|
||||||
|
},
|
||||||
"Microsoft.Net.Http.Headers": "1.1.0-*",
|
"Microsoft.Net.Http.Headers": "1.1.0-*",
|
||||||
"System.Buffers": "4.0.0-*"
|
"System.Buffers": "4.0.0-*"
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ using System.Threading.Tasks;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Http.Features;
|
using Microsoft.AspNetCore.Http.Features;
|
||||||
using Microsoft.AspNetCore.Http.Features.Authentication;
|
using Microsoft.AspNetCore.Http.Features.Authentication;
|
||||||
|
using Microsoft.Extensions.Internal;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Owin
|
namespace Microsoft.AspNetCore.Owin
|
||||||
{
|
{
|
||||||
|
|
@ -67,7 +68,7 @@ namespace Microsoft.AspNetCore.Owin
|
||||||
feature.OnStarting(s =>
|
feature.OnStarting(s =>
|
||||||
{
|
{
|
||||||
cb(s);
|
cb(s);
|
||||||
return Task.FromResult(0);
|
return TaskCache.CompletedTask;
|
||||||
}, state);
|
}, state);
|
||||||
}))
|
}))
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ using System.Net.WebSockets;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.Extensions.Internal;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Owin
|
namespace Microsoft.AspNetCore.Owin
|
||||||
{
|
{
|
||||||
|
|
@ -68,7 +69,7 @@ namespace Microsoft.AspNetCore.Owin
|
||||||
else if (messageType == 0x9 || messageType == 0xA)
|
else if (messageType == 0x9 || messageType == 0xA)
|
||||||
{
|
{
|
||||||
// Ping & Pong, not allowed by the underlying APIs, silently discard.
|
// Ping & Pong, not allowed by the underlying APIs, silently discard.
|
||||||
return Task.FromResult(0);
|
return TaskCache.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
return _webSocket.SendAsync(buffer, OpCodeToEnum(messageType), endOfMessage, cancel);
|
return _webSocket.SendAsync(buffer, OpCodeToEnum(messageType), endOfMessage, cancel);
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,11 @@
|
||||||
"xmlDoc": true
|
"xmlDoc": true
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"Microsoft.AspNetCore.Http": "1.1.0-*"
|
"Microsoft.AspNetCore.Http": "1.1.0-*",
|
||||||
|
"Microsoft.Extensions.TaskCache.Sources": {
|
||||||
|
"version": "1.1.0-*",
|
||||||
|
"type": "build"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"frameworks": {
|
"frameworks": {
|
||||||
"net451": {},
|
"net451": {},
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue