OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/websockets/websocket_throttle.h" | 5 #include "net/websockets/websocket_throttle.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <ws2tcpip.h> | 8 #include <ws2tcpip.h> |
9 #else | 9 #else |
10 #include <netdb.h> | 10 #include <netdb.h> |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 const AddressList& address_list = socket->address_list(); | 237 const AddressList& address_list = socket->address_list(); |
238 for (const struct addrinfo* addrinfo = address_list.head(); | 238 for (const struct addrinfo* addrinfo = address_list.head(); |
239 addrinfo != NULL; | 239 addrinfo != NULL; |
240 addrinfo = addrinfo->ai_next) { | 240 addrinfo = addrinfo->ai_next) { |
241 std::string addrkey = AddrinfoToHashkey(addrinfo); | 241 std::string addrkey = AddrinfoToHashkey(addrinfo); |
242 ConnectingAddressMap::iterator iter = addr_map_.find(addrkey); | 242 ConnectingAddressMap::iterator iter = addr_map_.find(addrkey); |
243 DCHECK(iter != addr_map_.end()); | 243 DCHECK(iter != addr_map_.end()); |
244 ConnectingQueue* queue = iter->second; | 244 ConnectingQueue* queue = iter->second; |
245 DCHECK(state == queue->front()); | 245 DCHECK(state == queue->front()); |
246 queue->pop_front(); | 246 queue->pop_front(); |
247 if (queue->empty()) | 247 if (queue->empty()) { |
| 248 delete queue; |
248 addr_map_.erase(iter); | 249 addr_map_.erase(iter); |
| 250 } |
249 } | 251 } |
250 for (ConnectingQueue::iterator iter = queue_.begin(); | 252 for (ConnectingQueue::iterator iter = queue_.begin(); |
251 iter != queue_.end(); | 253 iter != queue_.end(); |
252 ++iter) { | 254 ++iter) { |
253 if (*iter == state) { | 255 if (*iter == state) { |
254 queue_.erase(iter); | 256 queue_.erase(iter); |
255 break; | 257 break; |
256 } | 258 } |
257 } | 259 } |
258 socket->SetUserData(WebSocketState::kKeyName, NULL); | 260 socket->SetUserData(WebSocketState::kKeyName, NULL); |
(...skipping 25 matching lines...) Expand all Loading... |
284 state->Wakeup(); | 286 state->Wakeup(); |
285 } | 287 } |
286 } | 288 } |
287 | 289 |
288 /* static */ | 290 /* static */ |
289 void WebSocketThrottle::Init() { | 291 void WebSocketThrottle::Init() { |
290 Singleton<WebSocketThrottle>::get(); | 292 Singleton<WebSocketThrottle>::get(); |
291 } | 293 } |
292 | 294 |
293 } // namespace net | 295 } // namespace net |
OLD | NEW |