[Modify] Add a check

This commit is contained in:
sta 2016-03-27 14:56:34 +09:00
parent 49b09654f6
commit 8126aa5111

View File

@ -2870,7 +2870,6 @@ namespace WebSocketSharp
/// </param>
public void SetProxy (string url, string username, string password)
{
lock (_forConn) {
string msg;
if (!checkIfAvailable (true, false, true, false, false, true, out msg)) {
_logger.Error (msg);
@ -2879,6 +2878,14 @@ namespace WebSocketSharp
return;
}
lock (_forConn) {
if (!checkIfAvailable (true, false, false, true, out msg)) {
_logger.Error (msg);
error ("An error has occurred in setting the proxy.", null);
return;
}
if (url.IsNullOrEmpty ()) {
_logger.Warn ("The proxy url and credentials are set back to the default.");
_proxyUri = null;