Modified WebSocketServerBase.cs

This commit is contained in:
sta 2013-07-24 17:47:29 +09:00
parent cd7dfea62d
commit c365d1b521

View File

@ -34,16 +34,16 @@ using System.Security.Cryptography.X509Certificates;
using System.Threading;
using WebSocketSharp.Net.WebSockets;
namespace WebSocketSharp.Server {
namespace WebSocketSharp.Server
{
/// <summary>
/// Provides the basic functions of the server that receives the WebSocket connection requests.
/// </summary>
/// <remarks>
/// The WebSocketServerBase class is an abstract class.
/// </remarks>
public abstract class WebSocketServerBase {
public abstract class WebSocketServerBase
{
#region Private Fields
private IPAddress _address;
@ -103,7 +103,7 @@ namespace WebSocketSharp.Server {
/// </exception>
protected WebSocketServerBase (string url)
{
if (url.IsNull())
if (url == null)
throw new ArgumentNullException ("url");
Uri uri;
@ -148,10 +148,10 @@ namespace WebSocketSharp.Server {
/// </exception>
protected WebSocketServerBase (IPAddress address, int port, string absPath, bool secure)
{
if (address.IsNull())
if (address == null)
throw new ArgumentNullException ("address");
if (absPath.IsNull())
if (absPath == null)
throw new ArgumentNullException ("absPath");
string msg;
@ -270,7 +270,7 @@ namespace WebSocketSharp.Server {
/// </summary>
/// <remarks>
/// 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.
/// </remarks>
/// <value>
@ -345,8 +345,7 @@ namespace WebSocketSharp.Server {
{
WaitCallback callback = state =>
{
try
{
try {
AcceptWebSocket (client.GetWebSocketContext (_secure, _cert));
}
catch (Exception ex)
@ -363,17 +362,14 @@ namespace WebSocketSharp.Server {
{
while (true)
{
try
{
try {
processRequestAsync (_listener.AcceptTcpClient ());
}
catch (SocketException)
{
catch (SocketException) {
_logger.Info ("TcpListener has been stopped.");
break;
}
catch (Exception ex)
{
catch (Exception ex) {
_logger.Fatal (ex.Message);
error ("An exception has occured.");