OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |