Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(73)

Side by Side Diff: net/socket_stream/socket_stream.cc

Issue 10668018: Websocket should fire 'error' event if no server available (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: For reland (tyoshino) Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/common/socket_stream_messages.h ('k') | net/socket_stream/socket_stream_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 // 4 //
5 // TODO(ukai): code is similar with http_network_transaction.cc. We should 5 // TODO(ukai): code is similar with http_network_transaction.cc. We should
6 // think about ways to share code, if possible. 6 // think about ways to share code, if possible.
7 7
8 #include "net/socket_stream/socket_stream.h" 8 #include "net/socket_stream/socket_stream.h"
9 9
10 #include <set> 10 #include <set>
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 DCHECK_LE(result, OK); 351 DCHECK_LE(result, OK);
352 if (result == OK) 352 if (result == OK)
353 result = ERR_CONNECTION_CLOSED; 353 result = ERR_CONNECTION_CLOSED;
354 DCHECK_EQ(next_state_, STATE_NONE); 354 DCHECK_EQ(next_state_, STATE_NONE);
355 DVLOG(1) << "Finish result=" << ErrorToString(result); 355 DVLOG(1) << "Finish result=" << ErrorToString(result);
356 356
357 metrics_->OnClose(); 357 metrics_->OnClose();
358 Delegate* delegate = delegate_; 358 Delegate* delegate = delegate_;
359 delegate_ = NULL; 359 delegate_ = NULL;
360 if (delegate) { 360 if (delegate) {
361 delegate->OnError(this, result); 361 if (result != ERR_CONNECTION_CLOSED)
362 delegate->OnError(this, result);
362 if (result != ERR_PROTOCOL_SWITCHED) 363 if (result != ERR_PROTOCOL_SWITCHED)
363 delegate->OnClose(this); 364 delegate->OnClose(this);
364 } 365 }
365 Release(); 366 Release();
366 } 367 }
367 368
368 int SocketStream::DidEstablishConnection() { 369 int SocketStream::DidEstablishConnection() {
369 if (!socket_.get() || !socket_->IsConnected()) { 370 if (!socket_.get() || !socket_->IsConnected()) {
370 next_state_ = STATE_CLOSE; 371 next_state_ = STATE_CLOSE;
371 return ERR_CONNECTION_FAILED; 372 return ERR_CONNECTION_FAILED;
(...skipping 934 matching lines...) Expand 10 before | Expand all | Expand 10 after
1306 1307
1307 SSLConfigService* SocketStream::ssl_config_service() const { 1308 SSLConfigService* SocketStream::ssl_config_service() const {
1308 return context_->ssl_config_service(); 1309 return context_->ssl_config_service();
1309 } 1310 }
1310 1311
1311 ProxyService* SocketStream::proxy_service() const { 1312 ProxyService* SocketStream::proxy_service() const {
1312 return context_->proxy_service(); 1313 return context_->proxy_service();
1313 } 1314 }
1314 1315
1315 } // namespace net 1316 } // namespace net
OLDNEW
« no previous file with comments | « content/common/socket_stream_messages.h ('k') | net/socket_stream/socket_stream_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698