Refactored a few for WebSocket.cs
This commit is contained in:
parent
dbe7e0b17c
commit
d3410a3ac4
@ -509,9 +509,7 @@ namespace WebSocketSharp
|
|||||||
/// </value>
|
/// </value>
|
||||||
public Uri Url {
|
public Uri Url {
|
||||||
get {
|
get {
|
||||||
return _client
|
return _client ? _uri : _context.RequestUri;
|
||||||
? _uri
|
|
||||||
: _context.RequestUri;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -897,9 +895,7 @@ namespace WebSocketSharp
|
|||||||
private MessageEventArgs dequeueFromMessageEventQueue ()
|
private MessageEventArgs dequeueFromMessageEventQueue ()
|
||||||
{
|
{
|
||||||
lock (_forMessageEventQueue)
|
lock (_forMessageEventQueue)
|
||||||
return _messageEventQueue.Count > 0
|
return _messageEventQueue.Count > 0 ? _messageEventQueue.Dequeue () : null;
|
||||||
? _messageEventQueue.Dequeue ()
|
|
||||||
: null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// As client
|
// As client
|
||||||
@ -1223,8 +1219,7 @@ namespace WebSocketSharp
|
|||||||
else
|
else
|
||||||
buff = new byte[rem];
|
buff = new byte[rem];
|
||||||
|
|
||||||
return stream.Read (buff, 0, rem) == rem &&
|
return stream.Read (buff, 0, rem) == rem && send (Fin.Final, Opcode.Cont, buff, compressed);
|
||||||
send (Fin.Final, Opcode.Cont, buff, compressed);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool send (Fin fin, Opcode opcode, byte[] data, bool compressed)
|
private bool send (Fin fin, Opcode opcode, byte[] data, bool compressed)
|
||||||
@ -1767,8 +1762,7 @@ namespace WebSocketSharp
|
|||||||
/// the allowable range of the close status code.
|
/// the allowable range of the close status code.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <param name="code">
|
/// <param name="code">
|
||||||
/// A <see cref="ushort"/> that represents the status code indicating the reason for
|
/// A <see cref="ushort"/> that represents the status code indicating the reason for the close.
|
||||||
/// the close.
|
|
||||||
/// </param>
|
/// </param>
|
||||||
public void Close (ushort code)
|
public void Close (ushort code)
|
||||||
{
|
{
|
||||||
@ -1946,8 +1940,8 @@ namespace WebSocketSharp
|
|||||||
/// This method doesn't wait for the close to be complete.
|
/// This method doesn't wait for the close to be complete.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <param name="code">
|
/// <param name="code">
|
||||||
/// One of the <see cref="CloseStatusCode"/> enum values, represents
|
/// One of the <see cref="CloseStatusCode"/> enum values, represents the status code indicating
|
||||||
/// the status code indicating the reason for the close.
|
/// the reason for the close.
|
||||||
/// </param>
|
/// </param>
|
||||||
public void CloseAsync (CloseStatusCode code)
|
public void CloseAsync (CloseStatusCode code)
|
||||||
{
|
{
|
||||||
@ -2022,8 +2016,8 @@ namespace WebSocketSharp
|
|||||||
/// </para>
|
/// </para>
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <param name="code">
|
/// <param name="code">
|
||||||
/// One of the <see cref="CloseStatusCode"/> enum values, represents
|
/// One of the <see cref="CloseStatusCode"/> enum values, represents the status code indicating
|
||||||
/// the status code indicating the reason for the close.
|
/// the reason for the close.
|
||||||
/// </param>
|
/// </param>
|
||||||
/// <param name="reason">
|
/// <param name="reason">
|
||||||
/// A <see cref="string"/> that represents the reason for the close.
|
/// A <see cref="string"/> that represents the reason for the close.
|
||||||
@ -2331,8 +2325,8 @@ namespace WebSocketSharp
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sets an HTTP <paramref name="cookie"/> to send with the WebSocket connection request to
|
/// Sets an HTTP <paramref name="cookie"/> to send with
|
||||||
/// the server.
|
/// the WebSocket connection request to the server.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="cookie">
|
/// <param name="cookie">
|
||||||
/// A <see cref="Cookie"/> that represents the cookie to send.
|
/// A <see cref="Cookie"/> that represents the cookie to send.
|
||||||
@ -2361,12 +2355,12 @@ namespace WebSocketSharp
|
|||||||
/// A <see cref="string"/> that represents the user name used to authenticate.
|
/// A <see cref="string"/> that represents the user name used to authenticate.
|
||||||
/// </param>
|
/// </param>
|
||||||
/// <param name="password">
|
/// <param name="password">
|
||||||
/// A <see cref="string"/> that represents the password for <paramref name="username"/>
|
/// A <see cref="string"/> that represents the password for <paramref name="username"/> used
|
||||||
/// used to authenticate.
|
/// to authenticate.
|
||||||
/// </param>
|
/// </param>
|
||||||
/// <param name="preAuth">
|
/// <param name="preAuth">
|
||||||
/// <c>true</c> if the <see cref="WebSocket"/> sends the Basic authentication credentials
|
/// <c>true</c> if the <see cref="WebSocket"/> sends the Basic authentication credentials with
|
||||||
/// with the first connection request to the server; otherwise, <c>false</c>.
|
/// the first connection request to the server; otherwise, <c>false</c>.
|
||||||
/// </param>
|
/// </param>
|
||||||
public void SetCredentials (string username, string password, bool preAuth)
|
public void SetCredentials (string username, string password, bool preAuth)
|
||||||
{
|
{
|
||||||
@ -2401,9 +2395,9 @@ namespace WebSocketSharp
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sets an HTTP Proxy server URL to connect through, and if necessary, a pair of
|
/// Sets an HTTP Proxy server URL to connect through, and if necessary,
|
||||||
/// <paramref name="username"/> and <paramref name="password"/> for the proxy server
|
/// a pair of <paramref name="username"/> and <paramref name="password"/> for
|
||||||
/// authentication (Basic/Digest).
|
/// the proxy server authentication (Basic/Digest).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="url">
|
/// <param name="url">
|
||||||
/// A <see cref="string"/> that represents the proxy server URL to connect through.
|
/// A <see cref="string"/> that represents the proxy server URL to connect through.
|
||||||
@ -2412,8 +2406,8 @@ namespace WebSocketSharp
|
|||||||
/// A <see cref="string"/> that represents the user name used to authenticate.
|
/// A <see cref="string"/> that represents the user name used to authenticate.
|
||||||
/// </param>
|
/// </param>
|
||||||
/// <param name="password">
|
/// <param name="password">
|
||||||
/// A <see cref="string"/> that represents the password for <paramref name="username"/>
|
/// A <see cref="string"/> that represents the password for <paramref name="username"/> used
|
||||||
/// used to authenticate.
|
/// to authenticate.
|
||||||
/// </param>
|
/// </param>
|
||||||
public void SetProxy (string url, string username, string password)
|
public void SetProxy (string url, string username, string password)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user