Modified WebSocketServerBase.cs
This commit is contained in:
parent
cd7dfea62d
commit
c365d1b521
@ -34,16 +34,16 @@ using System.Security.Cryptography.X509Certificates;
|
|||||||
using System.Threading;
|
using System.Threading;
|
||||||
using WebSocketSharp.Net.WebSockets;
|
using WebSocketSharp.Net.WebSockets;
|
||||||
|
|
||||||
namespace WebSocketSharp.Server {
|
namespace WebSocketSharp.Server
|
||||||
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Provides the basic functions of the server that receives the WebSocket connection requests.
|
/// Provides the basic functions of the server that receives the WebSocket connection requests.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// The WebSocketServerBase class is an abstract class.
|
/// The WebSocketServerBase class is an abstract class.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public abstract class WebSocketServerBase {
|
public abstract class WebSocketServerBase
|
||||||
|
{
|
||||||
#region Private Fields
|
#region Private Fields
|
||||||
|
|
||||||
private IPAddress _address;
|
private IPAddress _address;
|
||||||
@ -103,7 +103,7 @@ namespace WebSocketSharp.Server {
|
|||||||
/// </exception>
|
/// </exception>
|
||||||
protected WebSocketServerBase (string url)
|
protected WebSocketServerBase (string url)
|
||||||
{
|
{
|
||||||
if (url.IsNull())
|
if (url == null)
|
||||||
throw new ArgumentNullException ("url");
|
throw new ArgumentNullException ("url");
|
||||||
|
|
||||||
Uri uri;
|
Uri uri;
|
||||||
@ -148,10 +148,10 @@ namespace WebSocketSharp.Server {
|
|||||||
/// </exception>
|
/// </exception>
|
||||||
protected WebSocketServerBase (IPAddress address, int port, string absPath, bool secure)
|
protected WebSocketServerBase (IPAddress address, int port, string absPath, bool secure)
|
||||||
{
|
{
|
||||||
if (address.IsNull())
|
if (address == null)
|
||||||
throw new ArgumentNullException ("address");
|
throw new ArgumentNullException ("address");
|
||||||
|
|
||||||
if (absPath.IsNull())
|
if (absPath == null)
|
||||||
throw new ArgumentNullException ("absPath");
|
throw new ArgumentNullException ("absPath");
|
||||||
|
|
||||||
string msg;
|
string msg;
|
||||||
@ -270,7 +270,7 @@ namespace WebSocketSharp.Server {
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// The default logging level is the <see cref="LogLevel.ERROR"/>.
|
/// The default logging level is the <see cref="LogLevel.ERROR"/>.
|
||||||
/// If you wanted to change the current logging level, you would set the <c>Log.Level</c> property
|
/// If you want to change the current logging level, you set the <c>Log.Level</c> property
|
||||||
/// to one of the <see cref="LogLevel"/> values which you want.
|
/// to one of the <see cref="LogLevel"/> values which you want.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <value>
|
/// <value>
|
||||||
@ -345,8 +345,7 @@ namespace WebSocketSharp.Server {
|
|||||||
{
|
{
|
||||||
WaitCallback callback = state =>
|
WaitCallback callback = state =>
|
||||||
{
|
{
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
AcceptWebSocket (client.GetWebSocketContext (_secure, _cert));
|
AcceptWebSocket (client.GetWebSocketContext (_secure, _cert));
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@ -363,17 +362,14 @@ namespace WebSocketSharp.Server {
|
|||||||
{
|
{
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
processRequestAsync (_listener.AcceptTcpClient ());
|
processRequestAsync (_listener.AcceptTcpClient ());
|
||||||
}
|
}
|
||||||
catch (SocketException)
|
catch (SocketException) {
|
||||||
{
|
|
||||||
_logger.Info ("TcpListener has been stopped.");
|
_logger.Info ("TcpListener has been stopped.");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex) {
|
||||||
{
|
|
||||||
_logger.Fatal (ex.Message);
|
_logger.Fatal (ex.Message);
|
||||||
error ("An exception has occured.");
|
error ("An exception has occured.");
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user