[Modify] Add a check
This commit is contained in:
parent
5bf96cf7ff
commit
49b09654f6
@ -2810,7 +2810,6 @@ namespace WebSocketSharp
|
|||||||
/// </param>
|
/// </param>
|
||||||
public void SetCredentials (string username, string password, bool preAuth)
|
public void SetCredentials (string username, string password, bool preAuth)
|
||||||
{
|
{
|
||||||
lock (_forConn) {
|
|
||||||
string msg;
|
string msg;
|
||||||
if (!checkIfAvailable (true, false, true, false, false, true, out msg)) {
|
if (!checkIfAvailable (true, false, true, false, false, true, out msg)) {
|
||||||
_logger.Error (msg);
|
_logger.Error (msg);
|
||||||
@ -2819,6 +2818,14 @@ namespace WebSocketSharp
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lock (_forConn) {
|
||||||
|
if (!checkIfAvailable (true, false, false, true, out msg)) {
|
||||||
|
_logger.Error (msg);
|
||||||
|
error ("An error has occurred in setting the credentials.", null);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (username.IsNullOrEmpty ()) {
|
if (username.IsNullOrEmpty ()) {
|
||||||
_logger.Warn ("The credentials are set back to the default.");
|
_logger.Warn ("The credentials are set back to the default.");
|
||||||
_credentials = null;
|
_credentials = null;
|
||||||
|
Loading…
Reference in New Issue
Block a user