Code review cleanup.

This commit is contained in:
Chris Ross 2014-03-20 11:21:03 -07:00
parent 9e8032cc8a
commit eb27892470
6 changed files with 13 additions and 18 deletions

View File

@ -13,12 +13,6 @@ namespace Microsoft.AspNet.Server.WebListener
{
internal static class LogHelper
{
private static readonly Func<object, Exception, string> LogState =
(state, error) => Convert.ToString(state, CultureInfo.CurrentCulture);
private static readonly Func<object, Exception, string> LogStateAndError =
(state, error) => string.Format(CultureInfo.CurrentCulture, "{0}\r\n{1}", state, error);
internal static ILogger CreateLogger(ILoggerFactory factory, Type type)
{
if (factory == null)

View File

@ -47,10 +47,10 @@ namespace Microsoft.AspNet.Server.WebListener
/// </summary>
/// <param name="properties"></param>
[SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Justification = "Disposed by caller")]
public IServerInformation Initialize(IConfiguration config)
public IServerInformation Initialize(IConfiguration configuration)
{
OwinWebListener listener = new OwinWebListener();
ParseAddresses(config, listener);
ParseAddresses(configuration, listener);
return new WebListenerWrapper(listener, _loggerFactory);
}

View File

@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.Contracts;
using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNet.Abstractions;
@ -44,7 +45,7 @@ namespace Microsoft.AspNet.Server.WebListener
// Microsoft.AspNet.Server.WebListener
public string Name
{
get { return System.Reflection.IntrospectionExtensions.GetTypeInfo(GetType()).Assembly.GetName().Name; }
get { return GetType().GetTypeInfo().Assembly.GetName().Name; }
}
internal void Start(AppFunc app)

View File

@ -1,16 +1,16 @@
/* TODO: Take a temp dependency on Ms.Aspnet.Hosting until AssemblyNeutral gets fixed.
using System;
using System.Threading.Tasks;
using Microsoft.Net.Runtime;
using Microsoft.AspNet.Abstractions;
using Microsoft.AspNet.ConfigurationModel;
namespace Microsoft.AspNet.Hosting.Server
{
[AssemblyNeutral]
// TODO: [AssemblyNeutral]
public interface IServerFactory
{
// IServerConfiguration CreateConfiguration();
// IDisposable Start(IServerConfiguration serverConfig, Func<object, Task> app);
IDisposable Start(Func<object, Task> app);
IServerInformation Initialize(IConfiguration configuration);
IDisposable Start(IServerInformation serverInformation, Func<object, Task> application);
}
}
*/

View File

@ -150,8 +150,8 @@ namespace Microsoft.AspNet.Server.WebListener.Test
private IDisposable CreateServer(AppFunc app)
{
ServerFactory factory = new ServerFactory(null);
WebListenerWrapper wrapper = (WebListenerWrapper)factory.Initialize(null);
var factory = new ServerFactory(null);
var wrapper = (WebListenerWrapper)factory.Initialize(null);
foreach (string path in new[] { "/", "/11", "/2/3", "/2", "/11/2" })
{

View File

@ -191,8 +191,8 @@ namespace Microsoft.AspNet.Server.WebListener.Test
[Fact]
public async Task Server_SetQueueLimit_Success()
{
ServerFactory factory = new ServerFactory(null);
WebListenerWrapper wrapper = (WebListenerWrapper)factory.Initialize(null);
var factory = new ServerFactory(null);
var wrapper = (WebListenerWrapper)factory.Initialize(null);
wrapper.Listener.UriPrefixes.Add(Prefix.Create("http://localhost:8080"));
wrapper.Listener.SetRequestQueueLimit(1001);