Renamed ServiceManager.cs to ServiceHostManager.cs
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
*
|
||||
* The MIT License
|
||||
*
|
||||
* Copyright (c) 2012 sta.blockhead
|
||||
* Copyright (c) 2012-2013 sta.blockhead
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -40,12 +40,12 @@ namespace WebSocketSharp.Server {
|
||||
|
||||
#region Fields
|
||||
|
||||
private Thread _acceptRequestThread;
|
||||
private bool _isWindows;
|
||||
private HttpListener _listener;
|
||||
private int _port;
|
||||
private string _rootPath;
|
||||
private ServiceManager _services;
|
||||
private Thread _acceptRequestThread;
|
||||
private bool _isWindows;
|
||||
private HttpListener _listener;
|
||||
private int _port;
|
||||
private string _rootPath;
|
||||
private ServiceHostManager _svcHosts;
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -70,19 +70,19 @@ namespace WebSocketSharp.Server {
|
||||
get { return _port; }
|
||||
}
|
||||
|
||||
public IEnumerable<string> ServicePath {
|
||||
public IEnumerable<string> ServicePaths {
|
||||
get {
|
||||
return _services.Path;
|
||||
return _svcHosts.Paths;
|
||||
}
|
||||
}
|
||||
|
||||
public bool Sweeped {
|
||||
get {
|
||||
return _services.Sweeped;
|
||||
return _svcHosts.Sweeped;
|
||||
}
|
||||
|
||||
set {
|
||||
_services.Sweeped = value;
|
||||
_svcHosts.Sweeped = value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,7 +136,7 @@ namespace WebSocketSharp.Server {
|
||||
{
|
||||
_isWindows = false;
|
||||
_listener = new HttpListener();
|
||||
_services = new ServiceManager();
|
||||
_svcHosts = new ServiceHostManager();
|
||||
|
||||
var os = Environment.OSVersion;
|
||||
if (os.Platform != PlatformID.Unix && os.Platform != PlatformID.MacOSX)
|
||||
@@ -278,7 +278,7 @@ namespace WebSocketSharp.Server {
|
||||
var path = wsContext.Path.UrlDecode();
|
||||
|
||||
IServiceHost svcHost;
|
||||
if (!_services.TryGetServiceHost(path, out svcHost))
|
||||
if (!_svcHosts.TryGetServiceHost(path, out svcHost))
|
||||
{
|
||||
res.StatusCode = (int)HttpStatusCode.NotImplemented;
|
||||
return false;
|
||||
@@ -307,7 +307,7 @@ namespace WebSocketSharp.Server {
|
||||
if (!Sweeped)
|
||||
svcHost.Sweeped = Sweeped;
|
||||
|
||||
_services.Add(absPath, svcHost);
|
||||
_svcHosts.Add(absPath, svcHost);
|
||||
}
|
||||
|
||||
public byte[] GetFile(string path)
|
||||
@@ -332,7 +332,7 @@ namespace WebSocketSharp.Server {
|
||||
{
|
||||
_listener.Close();
|
||||
_acceptRequestThread.Join(5 * 1000);
|
||||
_services.Stop();
|
||||
_svcHosts.Stop();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@@ -1,10 +1,10 @@
|
||||
#region MIT License
|
||||
/*
|
||||
* ServiceManager.cs
|
||||
* ServiceHostManager.cs
|
||||
*
|
||||
* The MIT License
|
||||
*
|
||||
* Copyright (c) 2012 sta.blockhead
|
||||
* Copyright (c) 2012-2013 sta.blockhead
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -31,20 +31,20 @@ using System.Collections.Generic;
|
||||
|
||||
namespace WebSocketSharp.Server {
|
||||
|
||||
public class ServiceManager {
|
||||
internal class ServiceHostManager {
|
||||
|
||||
#region Field
|
||||
#region Fields
|
||||
|
||||
private Dictionary<string, IServiceHost> _services;
|
||||
private Dictionary<string, IServiceHost> _svcHosts;
|
||||
private bool _sweeped;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
|
||||
public ServiceManager()
|
||||
public ServiceHostManager()
|
||||
{
|
||||
_services = new Dictionary<string, IServiceHost>();
|
||||
_svcHosts = new Dictionary<string, IServiceHost>();
|
||||
_sweeped = true;
|
||||
}
|
||||
|
||||
@@ -54,10 +54,22 @@ namespace WebSocketSharp.Server {
|
||||
|
||||
public int Count {
|
||||
get {
|
||||
return _services.Count;
|
||||
return _svcHosts.Count;
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<string> Paths {
|
||||
get {
|
||||
return _svcHosts.Keys;
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<IServiceHost> ServiceHosts {
|
||||
get {
|
||||
return _svcHosts.Values;
|
||||
}
|
||||
}
|
||||
|
||||
public bool Sweeped {
|
||||
get {
|
||||
return _sweeped;
|
||||
@@ -67,49 +79,38 @@ namespace WebSocketSharp.Server {
|
||||
if (_sweeped ^ value)
|
||||
{
|
||||
_sweeped = value;
|
||||
foreach (var svcHost in _services.Values)
|
||||
foreach (var svcHost in _svcHosts.Values)
|
||||
svcHost.Sweeped = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<string> Path {
|
||||
get {
|
||||
return _services.Keys;
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<IServiceHost> ServiceHost {
|
||||
get {
|
||||
return _services.Values;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public void Add(string absPath, IServiceHost svcHost)
|
||||
{
|
||||
_services.Add(absPath.UrlDecode(), svcHost);
|
||||
_svcHosts.Add(absPath.UrlDecode(), svcHost);
|
||||
}
|
||||
|
||||
public void Broadcast(string data)
|
||||
{
|
||||
foreach (var svcHost in _services.Values)
|
||||
foreach (var svcHost in _svcHosts.Values)
|
||||
svcHost.Broadcast(data);
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
foreach (var svcHost in _services.Values)
|
||||
foreach (var svcHost in _svcHosts.Values)
|
||||
svcHost.Stop();
|
||||
_services.Clear();
|
||||
|
||||
_svcHosts.Clear();
|
||||
}
|
||||
|
||||
public bool TryGetServiceHost(string absPath, out IServiceHost svcHost)
|
||||
{
|
||||
return _services.TryGetValue(absPath, out svcHost);
|
||||
return _svcHosts.TryGetValue(absPath, out svcHost);
|
||||
}
|
||||
|
||||
#endregion
|
@@ -46,7 +46,7 @@ namespace WebSocketSharp.Server {
|
||||
{
|
||||
#region Field
|
||||
|
||||
private ServiceManager _services;
|
||||
private ServiceHostManager _svcHosts;
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -155,7 +155,7 @@ namespace WebSocketSharp.Server {
|
||||
var url = BaseUri.IsAbsoluteUri
|
||||
? BaseUri.ToString().TrimEnd('/')
|
||||
: String.Empty;
|
||||
foreach (var path in _services.Path)
|
||||
foreach (var path in _svcHosts.Paths)
|
||||
yield return url + path;
|
||||
}
|
||||
}
|
||||
@@ -168,11 +168,11 @@ namespace WebSocketSharp.Server {
|
||||
/// </value>
|
||||
public bool Sweeped {
|
||||
get {
|
||||
return _services.Sweeped;
|
||||
return _svcHosts.Sweeped;
|
||||
}
|
||||
|
||||
set {
|
||||
_services.Sweeped = value;
|
||||
_svcHosts.Sweeped = value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,7 +182,7 @@ namespace WebSocketSharp.Server {
|
||||
|
||||
private void init()
|
||||
{
|
||||
_services = new ServiceManager();
|
||||
_svcHosts = new ServiceHostManager();
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -201,7 +201,7 @@ namespace WebSocketSharp.Server {
|
||||
var path = context.Path.UrlDecode();
|
||||
|
||||
IServiceHost svcHost;
|
||||
if (!_services.TryGetServiceHost(path, out svcHost))
|
||||
if (!_svcHosts.TryGetServiceHost(path, out svcHost))
|
||||
{
|
||||
socket.Close(HttpStatusCode.NotImplemented);
|
||||
return;
|
||||
@@ -243,7 +243,7 @@ namespace WebSocketSharp.Server {
|
||||
if (!Sweeped)
|
||||
svcHost.Sweeped = Sweeped;
|
||||
|
||||
_services.Add(absPath, svcHost);
|
||||
_svcHosts.Add(absPath, svcHost);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -254,7 +254,7 @@ namespace WebSocketSharp.Server {
|
||||
/// </param>
|
||||
public void Broadcast(string data)
|
||||
{
|
||||
_services.Broadcast(data);
|
||||
_svcHosts.Broadcast(data);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -263,7 +263,7 @@ namespace WebSocketSharp.Server {
|
||||
public override void Stop()
|
||||
{
|
||||
base.Stop();
|
||||
_services.Stop();
|
||||
_svcHosts.Stop();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -284,7 +284,7 @@
|
||||
<td>[read-only]<div></div></td>
|
||||
<td>
|
||||
<b>
|
||||
<a href="#P:WebSocketSharp.Server.HttpServer.ServicePath">ServicePath</a>
|
||||
<a href="#P:WebSocketSharp.Server.HttpServer.ServicePaths">ServicePaths</a>
|
||||
</b>
|
||||
</td>
|
||||
<td>
|
||||
@@ -831,23 +831,23 @@
|
||||
<b>Namespace: </b>WebSocketSharp.Server<br /><b>Assembly: </b>websocket-sharp (in websocket-sharp.dll)</div>
|
||||
<hr size="1" />
|
||||
</blockquote>
|
||||
<h3 id="P:WebSocketSharp.Server.HttpServer.ServicePath">ServicePath Property</h3>
|
||||
<blockquote id="P:WebSocketSharp.Server.HttpServer.ServicePath:member">
|
||||
<h3 id="P:WebSocketSharp.Server.HttpServer.ServicePaths">ServicePaths Property</h3>
|
||||
<blockquote id="P:WebSocketSharp.Server.HttpServer.ServicePaths:member">
|
||||
<p class="Summary">
|
||||
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
|
||||
</p>
|
||||
<h2>Syntax</h2>
|
||||
<div class="Signature">public <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Collections.Generic.IEnumerable`1">IEnumerable<string></a> <b>ServicePath</b> { get; }</div>
|
||||
<div class="Signature">public <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Collections.Generic.IEnumerable`1">IEnumerable<string></a> <b>ServicePaths</b> { get; }</div>
|
||||
<h4 class="Subsection">Value</h4>
|
||||
<blockquote class="SubsectionBox" id="P:WebSocketSharp.Server.HttpServer.ServicePath:Value">
|
||||
<blockquote class="SubsectionBox" id="P:WebSocketSharp.Server.HttpServer.ServicePaths:Value">
|
||||
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
|
||||
</blockquote>
|
||||
<h2 class="Section">Remarks</h2>
|
||||
<div class="SectionBox" id="P:WebSocketSharp.Server.HttpServer.ServicePath:Remarks">
|
||||
<div class="SectionBox" id="P:WebSocketSharp.Server.HttpServer.ServicePaths:Remarks">
|
||||
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
|
||||
</div>
|
||||
<h2 class="Section">Requirements</h2>
|
||||
<div class="SectionBox" id="P:WebSocketSharp.Server.HttpServer.ServicePath:Version Information">
|
||||
<div class="SectionBox" id="P:WebSocketSharp.Server.HttpServer.ServicePaths:Version Information">
|
||||
<b>Namespace: </b>WebSocketSharp.Server<br /><b>Assembly: </b>websocket-sharp (in websocket-sharp.dll)</div>
|
||||
<hr size="1" />
|
||||
</blockquote>
|
||||
|
@@ -226,14 +226,6 @@
|
||||
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td>
|
||||
<a href="./ServiceManager.html">ServiceManager</a>
|
||||
</td>
|
||||
<td>
|
||||
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td>
|
||||
<a href="./SessionManager.html">SessionManager</a>
|
||||
|
@@ -474,14 +474,6 @@
|
||||
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td>
|
||||
<a href="WebSocketSharp.Server/ServiceManager.html">ServiceManager</a>
|
||||
</td>
|
||||
<td>
|
||||
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td>
|
||||
<a href="WebSocketSharp.Server/SessionManager.html">SessionManager</a>
|
||||
|
@@ -211,9 +211,9 @@
|
||||
<remarks>To be added.</remarks>
|
||||
</Docs>
|
||||
</Member>
|
||||
<Member MemberName="ServicePath">
|
||||
<MemberSignature Language="C#" Value="public System.Collections.Generic.IEnumerable<string> ServicePath { get; }" />
|
||||
<MemberSignature Language="ILAsm" Value=".property instance class System.Collections.Generic.IEnumerable`1<string> ServicePath" />
|
||||
<Member MemberName="ServicePaths">
|
||||
<MemberSignature Language="C#" Value="public System.Collections.Generic.IEnumerable<string> ServicePaths { get; }" />
|
||||
<MemberSignature Language="ILAsm" Value=".property instance class System.Collections.Generic.IEnumerable`1<string> ServicePaths" />
|
||||
<MemberType>Property</MemberType>
|
||||
<ReturnValue>
|
||||
<ReturnType>System.Collections.Generic.IEnumerable<System.String></ReturnType>
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<Overview>
|
||||
<Assemblies>
|
||||
<Assembly Name="websocket-sharp" Version="1.0.2.28541">
|
||||
<Assembly Name="websocket-sharp" Version="1.0.2.34976">
|
||||
<AssemblyPublicKey>[00 24 00 00 04 80 00 00 94 00 00 00 06 02 00 00 00 24 00 00 52 53 41 31 00 04 00 00 11 00 00 00 29 17 fb 89 fe c3 91 f7 2b cb 8b e2 61 d2 3f 05 93 6d 65 a8 9e 63 72 a6 f5 d5 2c f2 9d 20 fa 0b c0 70 6a f6 88 7e 8b 90 3f 39 f5 76 c8 48 e0 bb 7b b2 7b ed d3 10 a7 1a 0f 70 98 0f 7f f4 4b 53 09 d2 a5 ef 36 c3 56 b4 aa f0 91 72 63 25 07 89 e0 93 3e 3f 2e f2 b9 73 0e 12 15 5d 43 56 c3 f4 70 a5 89 fe f7 f6 ac 3e 77 c2 d8 d0 84 91 f4 0c d1 f3 8e dc c3 c3 b8 38 3d 0c bf 17 de 20 78 c1 ]</AssemblyPublicKey>
|
||||
<Attributes>
|
||||
<Attribute>
|
||||
@@ -70,7 +70,6 @@
|
||||
<Type Name="HttpServer" Kind="Class" />
|
||||
<Type Name="IServiceHost" Kind="Interface" />
|
||||
<Type Name="ResponseEventArgs" Kind="Class" />
|
||||
<Type Name="ServiceManager" Kind="Class" />
|
||||
<Type Name="SessionManager" Kind="Class" />
|
||||
<Type Name="WebSocketServer" Kind="Class" />
|
||||
<Type Name="WebSocketServerBase" Kind="Class" />
|
||||
|
@@ -109,7 +109,6 @@
|
||||
<Compile Include="Server\IServiceHost.cs" />
|
||||
<Compile Include="Server\SessionManager.cs" />
|
||||
<Compile Include="Server\WebSocketServiceHost.cs" />
|
||||
<Compile Include="Server\ServiceManager.cs" />
|
||||
<Compile Include="CloseStatusCode.cs" />
|
||||
<Compile Include="Fin.cs" />
|
||||
<Compile Include="Mask.cs" />
|
||||
@@ -120,6 +119,7 @@
|
||||
<Compile Include="Net\WebSockets\HttpListenerWebSocketContext.cs" />
|
||||
<Compile Include="Net\WebSockets\TcpListenerWebSocketContext.cs" />
|
||||
<Compile Include="Net\WebSockets\WebSocketContext.cs" />
|
||||
<Compile Include="Server\ServiceHostManager.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<ItemGroup>
|
||||
|
Binary file not shown.
Reference in New Issue
Block a user