[Modify] Remove it
This commit is contained in:
parent
7be26f98b3
commit
d05afaeea1
@ -1480,91 +1480,6 @@ namespace WebSocketSharp.Server
|
|||||||
stop (1001, String.Empty);
|
stop (1001, String.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Stops receiving incoming requests and closes each connection.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="code">
|
|
||||||
/// <para>
|
|
||||||
/// A <see cref="ushort"/> that represents the status code indicating
|
|
||||||
/// the reason for the WebSocket connection close.
|
|
||||||
/// </para>
|
|
||||||
/// <para>
|
|
||||||
/// The status codes are defined in
|
|
||||||
/// <see href="http://tools.ietf.org/html/rfc6455#section-7.4">
|
|
||||||
/// Section 7.4</see> of RFC 6455.
|
|
||||||
/// </para>
|
|
||||||
/// </param>
|
|
||||||
/// <param name="reason">
|
|
||||||
/// <para>
|
|
||||||
/// A <see cref="string"/> that represents the reason for the WebSocket
|
|
||||||
/// connection close.
|
|
||||||
/// </para>
|
|
||||||
/// <para>
|
|
||||||
/// The size must be 123 bytes or less in UTF-8.
|
|
||||||
/// </para>
|
|
||||||
/// </param>
|
|
||||||
/// <exception cref="ArgumentOutOfRangeException">
|
|
||||||
/// <para>
|
|
||||||
/// <paramref name="code"/> is less than 1000 or greater than 4999.
|
|
||||||
/// </para>
|
|
||||||
/// <para>
|
|
||||||
/// -or-
|
|
||||||
/// </para>
|
|
||||||
/// <para>
|
|
||||||
/// The size of <paramref name="reason"/> is greater than 123 bytes.
|
|
||||||
/// </para>
|
|
||||||
/// </exception>
|
|
||||||
/// <exception cref="ArgumentException">
|
|
||||||
/// <para>
|
|
||||||
/// <paramref name="code"/> is 1010 (mandatory extension).
|
|
||||||
/// </para>
|
|
||||||
/// <para>
|
|
||||||
/// -or-
|
|
||||||
/// </para>
|
|
||||||
/// <para>
|
|
||||||
/// <paramref name="code"/> is 1005 (no status) and there is reason.
|
|
||||||
/// </para>
|
|
||||||
/// <para>
|
|
||||||
/// -or-
|
|
||||||
/// </para>
|
|
||||||
/// <para>
|
|
||||||
/// <paramref name="reason"/> could not be UTF-8-encoded.
|
|
||||||
/// </para>
|
|
||||||
/// </exception>
|
|
||||||
[Obsolete ("This method will be removed.")]
|
|
||||||
public void Stop (ushort code, string reason)
|
|
||||||
{
|
|
||||||
if (!code.IsCloseStatusCode ()) {
|
|
||||||
var msg = "Less than 1000 or greater than 4999.";
|
|
||||||
throw new ArgumentOutOfRangeException ("code", msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (code == 1010) {
|
|
||||||
var msg = "1010 cannot be used.";
|
|
||||||
throw new ArgumentException (msg, "code");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!reason.IsNullOrEmpty ()) {
|
|
||||||
if (code == 1005) {
|
|
||||||
var msg = "1005 cannot be used.";
|
|
||||||
throw new ArgumentException (msg, "code");
|
|
||||||
}
|
|
||||||
|
|
||||||
byte[] bytes;
|
|
||||||
if (!reason.TryGetUTF8EncodedBytes (out bytes)) {
|
|
||||||
var msg = "It could not be UTF-8-encoded.";
|
|
||||||
throw new ArgumentException (msg, "reason");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bytes.Length > 123) {
|
|
||||||
var msg = "Its size is greater than 123 bytes.";
|
|
||||||
throw new ArgumentOutOfRangeException ("reason", msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stop (code, reason);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user