OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/websocket_endpoint_lock_manager.h" | 5 #include "net/socket/websocket_endpoint_lock_manager.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/single_thread_task_runner.h" | 12 #include "base/single_thread_task_runner.h" |
13 #include "base/threading/thread_task_runner_handle.h" | 13 #include "base/threading/thread_task_runner_handle.h" |
14 #include "net/base/net_errors.h" | 14 #include "net/base/net_errors.h" |
15 #include "net/log/net_log.h" | |
16 | 15 |
17 namespace net { | 16 namespace net { |
18 | 17 |
19 namespace { | 18 namespace { |
20 | 19 |
21 // This delay prevents DoS attacks. | 20 // This delay prevents DoS attacks. |
22 // TODO(ricea): Replace this with randomised truncated exponential backoff. | 21 // TODO(ricea): Replace this with randomised truncated exponential backoff. |
23 // See crbug.com/377613. | 22 // See crbug.com/377613. |
24 const int kUnlockDelayInMs = 10; | 23 const int kUnlockDelayInMs = 10; |
25 | 24 |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 LockInfoMap::iterator lock_info_it) { | 162 LockInfoMap::iterator lock_info_it) { |
164 DVLOG(3) << "Removing (StreamSocket*)" << lock_info_it->second.socket | 163 DVLOG(3) << "Removing (StreamSocket*)" << lock_info_it->second.socket |
165 << " for " << lock_info_it->first.ToString() << " (" | 164 << " for " << lock_info_it->first.ToString() << " (" |
166 << socket_lock_info_map_.size() << " socket(s) left)"; | 165 << socket_lock_info_map_.size() << " socket(s) left)"; |
167 size_t erased = socket_lock_info_map_.erase(lock_info_it->second.socket); | 166 size_t erased = socket_lock_info_map_.erase(lock_info_it->second.socket); |
168 DCHECK_EQ(1U, erased); | 167 DCHECK_EQ(1U, erased); |
169 lock_info_it->second.socket = NULL; | 168 lock_info_it->second.socket = NULL; |
170 } | 169 } |
171 | 170 |
172 } // namespace net | 171 } // namespace net |
OLD | NEW |