[Fix] Not error
This commit is contained in:
parent
5056e84679
commit
b21cb164de
@ -957,6 +957,16 @@ namespace WebSocketSharp
|
|||||||
|
|
||||||
private void close (ushort code, string reason)
|
private void close (ushort code, string reason)
|
||||||
{
|
{
|
||||||
|
if (_readyState == WebSocketState.Closing) {
|
||||||
|
_logger.Info ("The closing is already in progress.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_readyState == WebSocketState.Closed) {
|
||||||
|
_logger.Info ("The connection has already been closed.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (code == 1005) { // == no status
|
if (code == 1005) { // == no status
|
||||||
close (new CloseEventArgs (), true, true, false);
|
close (new CloseEventArgs (), true, true, false);
|
||||||
return;
|
return;
|
||||||
@ -975,7 +985,7 @@ namespace WebSocketSharp
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (_readyState == WebSocketState.Closed) {
|
if (_readyState == WebSocketState.Closed) {
|
||||||
_logger.Info ("The connection has been closed.");
|
_logger.Info ("The connection has already been closed.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1005,6 +1015,16 @@ namespace WebSocketSharp
|
|||||||
|
|
||||||
private void closeAsync (ushort code, string reason)
|
private void closeAsync (ushort code, string reason)
|
||||||
{
|
{
|
||||||
|
if (_readyState == WebSocketState.Closing) {
|
||||||
|
_logger.Info ("The closing is already in progress.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_readyState == WebSocketState.Closed) {
|
||||||
|
_logger.Info ("The connection has already been closed.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (code == 1005) { // == no status
|
if (code == 1005) { // == no status
|
||||||
closeAsync (new CloseEventArgs (), true, true, false);
|
closeAsync (new CloseEventArgs (), true, true, false);
|
||||||
return;
|
return;
|
||||||
@ -2121,7 +2141,7 @@ namespace WebSocketSharp
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (_readyState == WebSocketState.Closed) {
|
if (_readyState == WebSocketState.Closed) {
|
||||||
_logger.Info ("The connection has been closed.");
|
_logger.Info ("The connection has already been closed.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2329,23 +2349,23 @@ namespace WebSocketSharp
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Closes the WebSocket connection, and releases all associated resources.
|
/// Closes the WebSocket connection, and releases all associated resources.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// This method does nothing if the current state of the connection is
|
||||||
|
/// Closing or Closed.
|
||||||
|
/// </remarks>
|
||||||
public void Close ()
|
public void Close ()
|
||||||
{
|
{
|
||||||
string msg;
|
close (1005, String.Empty);
|
||||||
if (!checkIfAvailable (true, true, false, false, out msg)) {
|
|
||||||
_logger.Error (msg);
|
|
||||||
error ("An error has occurred in closing the connection.", null);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
close (new CloseEventArgs (), true, true, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Closes the WebSocket connection with the specified <paramref name="code"/>,
|
/// Closes the WebSocket connection with the specified <paramref name="code"/>,
|
||||||
/// and releases all associated resources.
|
/// and releases all associated resources.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// This method does nothing if the current state of the connection is
|
||||||
|
/// Closing or Closed.
|
||||||
|
/// </remarks>
|
||||||
/// <param name="code">
|
/// <param name="code">
|
||||||
/// A <see cref="ushort"/> that represents the status code indicating
|
/// A <see cref="ushort"/> that represents the status code indicating
|
||||||
/// the reason for the close. The status codes are defined in
|
/// the reason for the close. The status codes are defined in
|
||||||
@ -2355,13 +2375,6 @@ namespace WebSocketSharp
|
|||||||
public void Close (ushort code)
|
public void Close (ushort code)
|
||||||
{
|
{
|
||||||
string msg;
|
string msg;
|
||||||
if (!checkIfAvailable (true, true, false, false, out msg)) {
|
|
||||||
_logger.Error (msg);
|
|
||||||
error ("An error has occurred in closing the connection.", null);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!CheckParametersForClose (code, null, _client, out msg)) {
|
if (!CheckParametersForClose (code, null, _client, out msg)) {
|
||||||
_logger.Error (msg);
|
_logger.Error (msg);
|
||||||
error ("An error has occurred in closing the connection.", null);
|
error ("An error has occurred in closing the connection.", null);
|
||||||
@ -2369,13 +2382,17 @@ namespace WebSocketSharp
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
close (code, null);
|
close (code, String.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Closes the WebSocket connection with the specified <paramref name="code"/>,
|
/// Closes the WebSocket connection with the specified <paramref name="code"/>,
|
||||||
/// and releases all associated resources.
|
/// and releases all associated resources.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// This method does nothing if the current state of the connection is
|
||||||
|
/// Closing or Closed.
|
||||||
|
/// </remarks>
|
||||||
/// <param name="code">
|
/// <param name="code">
|
||||||
/// One of the <see cref="CloseStatusCode"/> enum values that represents
|
/// One of the <see cref="CloseStatusCode"/> enum values that represents
|
||||||
/// the status code indicating the reason for the close.
|
/// the status code indicating the reason for the close.
|
||||||
@ -2383,13 +2400,6 @@ namespace WebSocketSharp
|
|||||||
public void Close (CloseStatusCode code)
|
public void Close (CloseStatusCode code)
|
||||||
{
|
{
|
||||||
string msg;
|
string msg;
|
||||||
if (!checkIfAvailable (true, true, false, false, out msg)) {
|
|
||||||
_logger.Error (msg);
|
|
||||||
error ("An error has occurred in closing the connection.", null);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!CheckParametersForClose (code, null, _client, out msg)) {
|
if (!CheckParametersForClose (code, null, _client, out msg)) {
|
||||||
_logger.Error (msg);
|
_logger.Error (msg);
|
||||||
error ("An error has occurred in closing the connection.", null);
|
error ("An error has occurred in closing the connection.", null);
|
||||||
@ -2397,13 +2407,17 @@ namespace WebSocketSharp
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
close ((ushort) code, null);
|
close ((ushort) code, String.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Closes the WebSocket connection with the specified <paramref name="code"/> and
|
/// Closes the WebSocket connection with the specified <paramref name="code"/> and
|
||||||
/// <paramref name="reason"/>, and releases all associated resources.
|
/// <paramref name="reason"/>, and releases all associated resources.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// This method does nothing if the current state of the connection is
|
||||||
|
/// Closing or Closed.
|
||||||
|
/// </remarks>
|
||||||
/// <param name="code">
|
/// <param name="code">
|
||||||
/// A <see cref="ushort"/> that represents the status code indicating
|
/// A <see cref="ushort"/> that represents the status code indicating
|
||||||
/// the reason for the close. The status codes are defined in
|
/// the reason for the close. The status codes are defined in
|
||||||
@ -2417,13 +2431,6 @@ namespace WebSocketSharp
|
|||||||
public void Close (ushort code, string reason)
|
public void Close (ushort code, string reason)
|
||||||
{
|
{
|
||||||
string msg;
|
string msg;
|
||||||
if (!checkIfAvailable (true, true, false, false, out msg)) {
|
|
||||||
_logger.Error (msg);
|
|
||||||
error ("An error has occurred in closing the connection.", null);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!CheckParametersForClose (code, reason, _client, out msg)) {
|
if (!CheckParametersForClose (code, reason, _client, out msg)) {
|
||||||
_logger.Error (msg);
|
_logger.Error (msg);
|
||||||
error ("An error has occurred in closing the connection.", null);
|
error ("An error has occurred in closing the connection.", null);
|
||||||
@ -2438,6 +2445,10 @@ namespace WebSocketSharp
|
|||||||
/// Closes the WebSocket connection with the specified <paramref name="code"/> and
|
/// Closes the WebSocket connection with the specified <paramref name="code"/> and
|
||||||
/// <paramref name="reason"/>, and releases all associated resources.
|
/// <paramref name="reason"/>, and releases all associated resources.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// This method does nothing if the current state of the connection is
|
||||||
|
/// Closing or Closed.
|
||||||
|
/// </remarks>
|
||||||
/// <param name="code">
|
/// <param name="code">
|
||||||
/// One of the <see cref="CloseStatusCode"/> enum values that represents
|
/// One of the <see cref="CloseStatusCode"/> enum values that represents
|
||||||
/// the status code indicating the reason for the close.
|
/// the status code indicating the reason for the close.
|
||||||
@ -2449,13 +2460,6 @@ namespace WebSocketSharp
|
|||||||
public void Close (CloseStatusCode code, string reason)
|
public void Close (CloseStatusCode code, string reason)
|
||||||
{
|
{
|
||||||
string msg;
|
string msg;
|
||||||
if (!checkIfAvailable (true, true, false, false, out msg)) {
|
|
||||||
_logger.Error (msg);
|
|
||||||
error ("An error has occurred in closing the connection.", null);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!CheckParametersForClose (code, reason, _client, out msg)) {
|
if (!CheckParametersForClose (code, reason, _client, out msg)) {
|
||||||
_logger.Error (msg);
|
_logger.Error (msg);
|
||||||
error ("An error has occurred in closing the connection.", null);
|
error ("An error has occurred in closing the connection.", null);
|
||||||
@ -2471,19 +2475,17 @@ namespace WebSocketSharp
|
|||||||
/// all associated resources.
|
/// all associated resources.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// This method does not wait for the close to be complete.
|
/// <para>
|
||||||
|
/// This method does nothing if the current state of the connection is
|
||||||
|
/// Closing or Closed.
|
||||||
|
/// </para>
|
||||||
|
/// <para>
|
||||||
|
/// This method does not wait for the close to be complete.
|
||||||
|
/// </para>
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public void CloseAsync ()
|
public void CloseAsync ()
|
||||||
{
|
{
|
||||||
string msg;
|
closeAsync (1005, String.Empty);
|
||||||
if (!checkIfAvailable (true, true, false, false, out msg)) {
|
|
||||||
_logger.Error (msg);
|
|
||||||
error ("An error has occurred in closing the connection.", null);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
closeAsync (new CloseEventArgs (), true, true, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -2491,7 +2493,13 @@ namespace WebSocketSharp
|
|||||||
/// <paramref name="code"/>, and releases all associated resources.
|
/// <paramref name="code"/>, and releases all associated resources.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// This method does not wait for the close to be complete.
|
/// <para>
|
||||||
|
/// This method does nothing if the current state of the connection is
|
||||||
|
/// Closing or Closed.
|
||||||
|
/// </para>
|
||||||
|
/// <para>
|
||||||
|
/// This method does not wait for the close to be complete.
|
||||||
|
/// </para>
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <param name="code">
|
/// <param name="code">
|
||||||
/// A <see cref="ushort"/> that represents the status code indicating
|
/// A <see cref="ushort"/> that represents the status code indicating
|
||||||
@ -2502,13 +2510,6 @@ namespace WebSocketSharp
|
|||||||
public void CloseAsync (ushort code)
|
public void CloseAsync (ushort code)
|
||||||
{
|
{
|
||||||
string msg;
|
string msg;
|
||||||
if (!checkIfAvailable (true, true, false, false, out msg)) {
|
|
||||||
_logger.Error (msg);
|
|
||||||
error ("An error has occurred in closing the connection.", null);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!CheckParametersForClose (code, null, _client, out msg)) {
|
if (!CheckParametersForClose (code, null, _client, out msg)) {
|
||||||
_logger.Error (msg);
|
_logger.Error (msg);
|
||||||
error ("An error has occurred in closing the connection.", null);
|
error ("An error has occurred in closing the connection.", null);
|
||||||
@ -2516,7 +2517,7 @@ namespace WebSocketSharp
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
closeAsync (code, null);
|
closeAsync (code, String.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -2524,7 +2525,13 @@ namespace WebSocketSharp
|
|||||||
/// <paramref name="code"/>, and releases all associated resources.
|
/// <paramref name="code"/>, and releases all associated resources.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// This method does not wait for the close to be complete.
|
/// <para>
|
||||||
|
/// This method does nothing if the current state of the connection is
|
||||||
|
/// Closing or Closed.
|
||||||
|
/// </para>
|
||||||
|
/// <para>
|
||||||
|
/// This method does not wait for the close to be complete.
|
||||||
|
/// </para>
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <param name="code">
|
/// <param name="code">
|
||||||
/// One of the <see cref="CloseStatusCode"/> enum values that represents
|
/// One of the <see cref="CloseStatusCode"/> enum values that represents
|
||||||
@ -2533,13 +2540,6 @@ namespace WebSocketSharp
|
|||||||
public void CloseAsync (CloseStatusCode code)
|
public void CloseAsync (CloseStatusCode code)
|
||||||
{
|
{
|
||||||
string msg;
|
string msg;
|
||||||
if (!checkIfAvailable (true, true, false, false, out msg)) {
|
|
||||||
_logger.Error (msg);
|
|
||||||
error ("An error has occurred in closing the connection.", null);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!CheckParametersForClose (code, null, _client, out msg)) {
|
if (!CheckParametersForClose (code, null, _client, out msg)) {
|
||||||
_logger.Error (msg);
|
_logger.Error (msg);
|
||||||
error ("An error has occurred in closing the connection.", null);
|
error ("An error has occurred in closing the connection.", null);
|
||||||
@ -2547,7 +2547,7 @@ namespace WebSocketSharp
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
closeAsync ((ushort) code, null);
|
closeAsync ((ushort) code, String.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -2556,7 +2556,13 @@ namespace WebSocketSharp
|
|||||||
/// all associated resources.
|
/// all associated resources.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// This method does not wait for the close to be complete.
|
/// <para>
|
||||||
|
/// This method does nothing if the current state of the connection is
|
||||||
|
/// Closing or Closed.
|
||||||
|
/// </para>
|
||||||
|
/// <para>
|
||||||
|
/// This method does not wait for the close to be complete.
|
||||||
|
/// </para>
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <param name="code">
|
/// <param name="code">
|
||||||
/// A <see cref="ushort"/> that represents the status code indicating
|
/// A <see cref="ushort"/> that represents the status code indicating
|
||||||
@ -2571,13 +2577,6 @@ namespace WebSocketSharp
|
|||||||
public void CloseAsync (ushort code, string reason)
|
public void CloseAsync (ushort code, string reason)
|
||||||
{
|
{
|
||||||
string msg;
|
string msg;
|
||||||
if (!checkIfAvailable (true, true, false, false, out msg)) {
|
|
||||||
_logger.Error (msg);
|
|
||||||
error ("An error has occurred in closing the connection.", null);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!CheckParametersForClose (code, reason, _client, out msg)) {
|
if (!CheckParametersForClose (code, reason, _client, out msg)) {
|
||||||
_logger.Error (msg);
|
_logger.Error (msg);
|
||||||
error ("An error has occurred in closing the connection.", null);
|
error ("An error has occurred in closing the connection.", null);
|
||||||
@ -2594,7 +2593,13 @@ namespace WebSocketSharp
|
|||||||
/// all associated resources.
|
/// all associated resources.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// This method does not wait for the close to be complete.
|
/// <para>
|
||||||
|
/// This method does nothing if the current state of the connection is
|
||||||
|
/// Closing or Closed.
|
||||||
|
/// </para>
|
||||||
|
/// <para>
|
||||||
|
/// This method does not wait for the close to be complete.
|
||||||
|
/// </para>
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <param name="code">
|
/// <param name="code">
|
||||||
/// One of the <see cref="CloseStatusCode"/> enum values that represents
|
/// One of the <see cref="CloseStatusCode"/> enum values that represents
|
||||||
@ -2607,13 +2612,6 @@ namespace WebSocketSharp
|
|||||||
public void CloseAsync (CloseStatusCode code, string reason)
|
public void CloseAsync (CloseStatusCode code, string reason)
|
||||||
{
|
{
|
||||||
string msg;
|
string msg;
|
||||||
if (!checkIfAvailable (true, true, false, false, out msg)) {
|
|
||||||
_logger.Error (msg);
|
|
||||||
error ("An error has occurred in closing the connection.", null);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!CheckParametersForClose (code, reason, _client, out msg)) {
|
if (!CheckParametersForClose (code, reason, _client, out msg)) {
|
||||||
_logger.Error (msg);
|
_logger.Error (msg);
|
||||||
error ("An error has occurred in closing the connection.", null);
|
error ("An error has occurred in closing the connection.", null);
|
||||||
@ -3289,11 +3287,17 @@ namespace WebSocketSharp
|
|||||||
/// Closes the WebSocket connection, and releases all associated resources.
|
/// Closes the WebSocket connection, and releases all associated resources.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// This method closes the connection with status code 1001 (going away).
|
/// <para>
|
||||||
|
/// This method does nothing if the current state of the connection is
|
||||||
|
/// Closing or Closed.
|
||||||
|
/// </para>
|
||||||
|
/// <para>
|
||||||
|
/// This method closes the connection with status code 1001 (going away).
|
||||||
|
/// </para>
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
void IDisposable.Dispose ()
|
void IDisposable.Dispose ()
|
||||||
{
|
{
|
||||||
close (new CloseEventArgs (1001), true, true, false);
|
close (1001, String.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
Loading…
Reference in New Issue
Block a user