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 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 DCHECK_LE(result, OK); | 352 DCHECK_LE(result, OK); |
353 if (result == OK) | 353 if (result == OK) |
354 result = ERR_CONNECTION_CLOSED; | 354 result = ERR_CONNECTION_CLOSED; |
355 DCHECK_EQ(next_state_, STATE_NONE); | 355 DCHECK_EQ(next_state_, STATE_NONE); |
356 DVLOG(1) << "Finish result=" << ErrorToString(result); | 356 DVLOG(1) << "Finish result=" << ErrorToString(result); |
357 | 357 |
358 metrics_->OnClose(); | 358 metrics_->OnClose(); |
359 Delegate* delegate = delegate_; | 359 Delegate* delegate = delegate_; |
360 delegate_ = NULL; | 360 delegate_ = NULL; |
361 if (delegate) { | 361 if (delegate) { |
362 if (result != ERR_CONNECTION_CLOSED) | 362 delegate->OnError(this, result); |
363 delegate->OnError(this, result); | |
364 if (result != ERR_PROTOCOL_SWITCHED) | 363 if (result != ERR_PROTOCOL_SWITCHED) |
365 delegate->OnClose(this); | 364 delegate->OnClose(this); |
366 } | 365 } |
367 Release(); | 366 Release(); |
368 } | 367 } |
369 | 368 |
370 int SocketStream::DidEstablishConnection() { | 369 int SocketStream::DidEstablishConnection() { |
371 if (!socket_.get() || !socket_->IsConnected()) { | 370 if (!socket_.get() || !socket_->IsConnected()) { |
372 next_state_ = STATE_CLOSE; | 371 next_state_ = STATE_CLOSE; |
373 return ERR_CONNECTION_FAILED; | 372 return ERR_CONNECTION_FAILED; |
(...skipping 934 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1308 | 1307 |
1309 SSLConfigService* SocketStream::ssl_config_service() const { | 1308 SSLConfigService* SocketStream::ssl_config_service() const { |
1310 return context_->ssl_config_service(); | 1309 return context_->ssl_config_service(); |
1311 } | 1310 } |
1312 | 1311 |
1313 ProxyService* SocketStream::proxy_service() const { | 1312 ProxyService* SocketStream::proxy_service() const { |
1314 return context_->proxy_service(); | 1313 return context_->proxy_service(); |
1315 } | 1314 } |
1316 | 1315 |
1317 } // namespace net | 1316 } // namespace net |
OLD | NEW |