[Modify] Polish it
This commit is contained in:
parent
f276f96526
commit
bc794a6b6b
@ -342,11 +342,11 @@ namespace WebSocketSharp
|
|||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets a value indicating whether the <see cref="WebSocket"/> emits
|
/// Gets or sets a value indicating whether the <see cref="WebSocket"/> emits
|
||||||
/// a <see cref="OnMessage"/> event when receives a Ping.
|
/// a <see cref="OnMessage"/> event when receives a ping.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>
|
/// <value>
|
||||||
/// <c>true</c> if the <see cref="WebSocket"/> emits a <see cref="OnMessage"/> event
|
/// <c>true</c> if the <see cref="WebSocket"/> emits a <see cref="OnMessage"/> event
|
||||||
/// when receives a Ping; otherwise, <c>false</c>. The default value is <c>false</c>.
|
/// when receives a ping; otherwise, <c>false</c>. The default value is <c>false</c>.
|
||||||
/// </value>
|
/// </value>
|
||||||
public bool EmitOnPing {
|
public bool EmitOnPing {
|
||||||
get {
|
get {
|
||||||
@ -1060,7 +1060,7 @@ namespace WebSocketSharp
|
|||||||
private bool processPingFrame (WebSocketFrame frame)
|
private bool processPingFrame (WebSocketFrame frame)
|
||||||
{
|
{
|
||||||
if (send (new WebSocketFrame (Opcode.Pong, frame.PayloadData, _client).ToArray ()))
|
if (send (new WebSocketFrame (Opcode.Pong, frame.PayloadData, _client).ToArray ()))
|
||||||
_logger.Trace ("Returned a Pong.");
|
_logger.Trace ("Returned a pong.");
|
||||||
|
|
||||||
if (_emitOnPing)
|
if (_emitOnPing)
|
||||||
enqueueToMessageEventQueue (new MessageEventArgs (frame));
|
enqueueToMessageEventQueue (new MessageEventArgs (frame));
|
||||||
@ -1071,7 +1071,7 @@ namespace WebSocketSharp
|
|||||||
private bool processPongFrame (WebSocketFrame frame)
|
private bool processPongFrame (WebSocketFrame frame)
|
||||||
{
|
{
|
||||||
_receivePong.Set ();
|
_receivePong.Set ();
|
||||||
_logger.Trace ("Received a Pong.");
|
_logger.Trace ("Received a pong.");
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1497,7 +1497,7 @@ namespace WebSocketSharp
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Receive next asap because a Ping or Close needs a response to it.
|
// Receive next asap because the Ping or Close needs a response to it.
|
||||||
receive ();
|
receive ();
|
||||||
|
|
||||||
if ((frame.IsControl && !(frame.IsPing && _emitOnPing)) || !frame.IsFinal)
|
if ((frame.IsControl && !(frame.IsPing && _emitOnPing)) || !frame.IsFinal)
|
||||||
@ -2245,10 +2245,10 @@ namespace WebSocketSharp
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sends a Ping using the WebSocket connection.
|
/// Sends a ping using the WebSocket connection.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>
|
/// <returns>
|
||||||
/// <c>true</c> if the <see cref="WebSocket"/> receives a Pong to this Ping in a time;
|
/// <c>true</c> if the <see cref="WebSocket"/> receives a pong to this ping in a time;
|
||||||
/// otherwise, <c>false</c>.
|
/// otherwise, <c>false</c>.
|
||||||
/// </returns>
|
/// </returns>
|
||||||
public bool Ping ()
|
public bool Ping ()
|
||||||
@ -2261,10 +2261,10 @@ namespace WebSocketSharp
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sends a Ping with the specified <paramref name="message"/> using the WebSocket connection.
|
/// Sends a ping with the specified <paramref name="message"/> using the WebSocket connection.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>
|
/// <returns>
|
||||||
/// <c>true</c> if the <see cref="WebSocket"/> receives a Pong to this Ping in a time;
|
/// <c>true</c> if the <see cref="WebSocket"/> receives a pong to this ping in a time;
|
||||||
/// otherwise, <c>false</c>.
|
/// otherwise, <c>false</c>.
|
||||||
/// </returns>
|
/// </returns>
|
||||||
/// <param name="message">
|
/// <param name="message">
|
||||||
@ -2279,7 +2279,7 @@ namespace WebSocketSharp
|
|||||||
var msg = CheckPingParameter (message, out data);
|
var msg = CheckPingParameter (message, out data);
|
||||||
if (msg != null) {
|
if (msg != null) {
|
||||||
_logger.Error (msg);
|
_logger.Error (msg);
|
||||||
error ("An error has occurred in sending the ping.", null);
|
error ("An error has occurred in sending a ping.", null);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user