[Modify] Move it out

master
sta 9 years ago
parent 32b3043a58
commit 296ede4c33

@ -2818,32 +2818,34 @@ namespace WebSocketSharp
return; return;
} }
lock (_forState) { if (!username.IsNullOrEmpty ()) {
if (!checkIfAvailable (true, false, false, true, out msg)) { if (username.Contains (':') || !username.IsText ()) {
_logger.Error (msg); _logger.Error ("'username' contains an invalid character.");
error ("An error has occurred in setting the credentials.", null); error ("An error has occurred in setting the credentials.", null);
return; return;
} }
if (username.IsNullOrEmpty ()) { if (!password.IsNullOrEmpty () && !password.IsText ()) {
_logger.Warn ("The credentials are set back to the default."); _logger.Error ("'password' contains an invalid character.");
_credentials = null; error ("An error has occurred in setting the credentials.", null);
_preAuth = false;
return; return;
} }
}
if (username.Contains (':') || !username.IsText ()) { lock (_forState) {
_logger.Error ("'username' contains an invalid character."); if (!checkIfAvailable (true, false, false, true, out msg)) {
_logger.Error (msg);
error ("An error has occurred in setting the credentials.", null); error ("An error has occurred in setting the credentials.", null);
return; return;
} }
if (!password.IsNullOrEmpty () && !password.IsText ()) { if (username.IsNullOrEmpty ()) {
_logger.Error ("'password' contains an invalid character."); _logger.Warn ("The credentials are set back to the default.");
error ("An error has occurred in setting the credentials.", null); _credentials = null;
_preAuth = false;
return; return;
} }

Loading…
Cancel
Save