[Modify] Replace it

This commit is contained in:
sta 2016-03-19 16:25:47 +09:00
parent 6da672a65e
commit f096e3b561

View File

@ -2776,16 +2776,21 @@ namespace WebSocketSharp
public void SetCookie (Cookie cookie) public void SetCookie (Cookie cookie)
{ {
lock (_forConn) { lock (_forConn) {
var msg = checkIfAvailable (true, false, true, false, false, true) ?? string msg;
(cookie == null ? "'cookie' is null." : null); if (!checkIfAvailable (true, false, true, false, false, true, out msg)) {
if (msg != null) {
_logger.Error (msg); _logger.Error (msg);
error ("An error has occurred in setting a cookie.", null); error ("An error has occurred in setting a cookie.", null);
return; return;
} }
if (cookie == null) {
_logger.Error ("'cookie' is null.");
error ("An error has occurred in setting a cookie.", null);
return;
}
lock (_cookies.SyncRoot) lock (_cookies.SyncRoot)
_cookies.SetOrRemove (cookie); _cookies.SetOrRemove (cookie);
} }