[Modify] Remove it
This commit is contained in:
parent
509df2d814
commit
daf4e9e488
@ -1330,80 +1330,6 @@ namespace WebSocketSharp.Server
|
|||||||
stop (1001, String.Empty);
|
stop (1001, String.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Stops receiving incoming handshake requests and closes each connection
|
|
||||||
/// with the specified code and reason.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="code">
|
|
||||||
/// <para>
|
|
||||||
/// One of the <see cref="CloseStatusCode"/> enum values.
|
|
||||||
/// </para>
|
|
||||||
/// <para>
|
|
||||||
/// It represents the status code indicating the reason for the close.
|
|
||||||
/// </para>
|
|
||||||
/// </param>
|
|
||||||
/// <param name="reason">
|
|
||||||
/// <para>
|
|
||||||
/// A <see cref="string"/> that represents the reason for the close.
|
|
||||||
/// </para>
|
|
||||||
/// <para>
|
|
||||||
/// The size must be 123 bytes or less in UTF-8.
|
|
||||||
/// </para>
|
|
||||||
/// </param>
|
|
||||||
/// <exception cref="ArgumentException">
|
|
||||||
/// <para>
|
|
||||||
/// <paramref name="code"/> is
|
|
||||||
/// <see cref="CloseStatusCode.MandatoryExtension"/>.
|
|
||||||
/// </para>
|
|
||||||
/// <para>
|
|
||||||
/// -or-
|
|
||||||
/// </para>
|
|
||||||
/// <para>
|
|
||||||
/// <paramref name="code"/> is
|
|
||||||
/// <see cref="CloseStatusCode.NoStatus"/> and there is reason.
|
|
||||||
/// </para>
|
|
||||||
/// <para>
|
|
||||||
/// -or-
|
|
||||||
/// </para>
|
|
||||||
/// <para>
|
|
||||||
/// <paramref name="reason"/> could not be UTF-8-encoded.
|
|
||||||
/// </para>
|
|
||||||
/// </exception>
|
|
||||||
/// <exception cref="ArgumentOutOfRangeException">
|
|
||||||
/// The size of <paramref name="reason"/> is greater than 123 bytes.
|
|
||||||
/// </exception>
|
|
||||||
/// <exception cref="InvalidOperationException">
|
|
||||||
/// The underlying <see cref="TcpListener"/> has failed to stop.
|
|
||||||
/// </exception>
|
|
||||||
[Obsolete ("This method will be removed.")]
|
|
||||||
public void Stop (CloseStatusCode code, string reason)
|
|
||||||
{
|
|
||||||
if (code == CloseStatusCode.MandatoryExtension) {
|
|
||||||
var msg = "MandatoryExtension cannot be used.";
|
|
||||||
throw new ArgumentException (msg, "code");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!reason.IsNullOrEmpty ()) {
|
|
||||||
if (code == CloseStatusCode.NoStatus) {
|
|
||||||
var msg = "NoStatus 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 ((ushort) code, reason);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user