[Modify] Remove it and throw exception

This commit is contained in:
sta 2017-10-15 14:45:22 +09:00
parent bbc70c5314
commit 4c9f443bea

View File

@ -651,23 +651,20 @@ namespace WebSocketSharp
/// </value>
public ClientSslConfiguration SslConfiguration {
get {
return _client
? (_sslConfig ?? (_sslConfig = new ClientSslConfiguration (_uri.DnsSafeHost)))
: null;
if (!_client) {
var msg = "This instance is not a client.";
throw new InvalidOperationException (msg);
}
set {
lock (_forState) {
string msg;
if (!checkIfAvailable (true, false, true, false, false, true, out msg)) {
_logger.Error (msg);
error ("An error has occurred in setting the ssl configuration.", null);
return;
if (!_secure) {
var msg = "The connection is not secure.";
throw new InvalidOperationException (msg);
}
_sslConfig = value;
}
if (_sslConfig == null)
_sslConfig = new ClientSslConfiguration (_uri.DnsSafeHost);
return _sslConfig;
}
}