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

Side by Side Diff: net/socket/client_socket_handle.cc

Issue 197283012: Retry requests on reused sockets that receive ERR_EMPTY_RESPONSE. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Indentation Created 6 years, 9 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 | « net/socket/client_socket_handle.h ('k') | net/socket/client_socket_pool_base.h » ('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 #include "net/socket/client_socket_handle.h" 5 #include "net/socket/client_socket_handle.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "net/base/net_errors.h" 12 #include "net/base/net_errors.h"
13 #include "net/socket/client_socket_pool.h" 13 #include "net/socket/client_socket_pool.h"
14 #include "net/socket/client_socket_pool_histograms.h" 14 #include "net/socket/client_socket_pool_histograms.h"
15 15
16 namespace net { 16 namespace net {
17 17
18 ClientSocketHandle::ClientSocketHandle() 18 ClientSocketHandle::ClientSocketHandle()
19 : is_initialized_(false), 19 : is_initialized_(false),
20 pool_(NULL), 20 pool_(NULL),
21 higher_pool_(NULL), 21 higher_pool_(NULL),
22 is_reused_(false), 22 reuse_type_(ClientSocketHandle::UNUSED),
23 callback_(base::Bind(&ClientSocketHandle::OnIOComplete, 23 callback_(base::Bind(&ClientSocketHandle::OnIOComplete,
24 base::Unretained(this))), 24 base::Unretained(this))),
25 is_ssl_error_(false) {} 25 is_ssl_error_(false) {}
26 26
27 ClientSocketHandle::~ClientSocketHandle() { 27 ClientSocketHandle::~ClientSocketHandle() {
28 Reset(); 28 Reset();
29 } 29 }
30 30
31 void ClientSocketHandle::Reset() { 31 void ClientSocketHandle::Reset() {
32 ResetInternal(true); 32 ResetInternal(true);
(...skipping 18 matching lines...) Expand all
51 } 51 }
52 } else if (cancel) { 52 } else if (cancel) {
53 // If we did not get initialized yet and we have a socket 53 // If we did not get initialized yet and we have a socket
54 // request pending, cancel it. 54 // request pending, cancel it.
55 pool_->CancelRequest(group_name_, this); 55 pool_->CancelRequest(group_name_, this);
56 } 56 }
57 } 57 }
58 is_initialized_ = false; 58 is_initialized_ = false;
59 socket_.reset(); 59 socket_.reset();
60 group_name_.clear(); 60 group_name_.clear();
61 is_reused_ = false; 61 reuse_type_ = ClientSocketHandle::UNUSED;
62 user_callback_.Reset(); 62 user_callback_.Reset();
63 if (higher_pool_) 63 if (higher_pool_)
64 RemoveHigherLayeredPool(higher_pool_); 64 RemoveHigherLayeredPool(higher_pool_);
65 pool_ = NULL; 65 pool_ = NULL;
66 idle_time_ = base::TimeDelta(); 66 idle_time_ = base::TimeDelta();
67 init_time_ = base::TimeTicks(); 67 init_time_ = base::TimeTicks();
68 setup_time_ = base::TimeDelta(); 68 setup_time_ = base::TimeDelta();
69 connect_timing_ = LoadTimingInfo::ConnectTiming(); 69 connect_timing_ = LoadTimingInfo::ConnectTiming();
70 pool_id_ = -1; 70 pool_id_ = -1;
71 } 71 }
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 // TODO(eroman): This logging is not complete, in particular set_socket() and 182 // TODO(eroman): This logging is not complete, in particular set_socket() and
183 // release() socket. It ends up working though, since those methods are being 183 // release() socket. It ends up working though, since those methods are being
184 // used to layer sockets (and the destination sources are the same). 184 // used to layer sockets (and the destination sources are the same).
185 DCHECK(socket_.get()); 185 DCHECK(socket_.get());
186 socket_->NetLog().BeginEvent( 186 socket_->NetLog().BeginEvent(
187 NetLog::TYPE_SOCKET_IN_USE, 187 NetLog::TYPE_SOCKET_IN_USE,
188 requesting_source_.ToEventParametersCallback()); 188 requesting_source_.ToEventParametersCallback());
189 } 189 }
190 190
191 } // namespace net 191 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/client_socket_handle.h ('k') | net/socket/client_socket_pool_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698