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

Side by Side Diff: content/browser/devtools/tethering_handler.cc

Issue 285263003: DevTools: Fixed suspected bug in port forwarding (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed recv and immediate close scenario on Windows Created 6 years, 7 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
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 "content/browser/devtools/tethering_handler.h" 5 #include "content/browser/devtools/tethering_handler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 wire_buffer_size_ -= offset; 142 wire_buffer_size_ -= offset;
143 wire_buffer_->set_offset(0); 143 wire_buffer_->set_offset(0);
144 } 144 }
145 145
146 if (result != net::ERR_IO_PENDING) 146 if (result != net::ERR_IO_PENDING)
147 OnClientWrite(result); 147 OnClientWrite(result);
148 return; 148 return;
149 } 149 }
150 150
151 void SelfDestruct() { 151 void SelfDestruct() {
152 if (wire_buffer_->offset() != wire_buffer_size_) { 152 if (wire_buffer_ && wire_buffer_->offset() != wire_buffer_size_) {
153 pending_destruction_ = true; 153 pending_destruction_ = true;
154 return; 154 return;
155 } 155 }
156 delete this; 156 delete this;
157 } 157 }
158 158
159 private: 159 private:
160 scoped_ptr<net::StreamSocket> client_socket_; 160 scoped_ptr<net::StreamSocket> client_socket_;
161 scoped_ptr<net::StreamListenSocket> server_socket_; 161 scoped_ptr<net::StreamListenSocket> server_socket_;
162 scoped_ptr<net::StreamListenSocket> accepted_socket_; 162 scoped_ptr<net::StreamListenSocket> accepted_socket_;
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 BoundSockets::iterator it = bound_sockets_.find(port); 299 BoundSockets::iterator it = bound_sockets_.find(port);
300 if (it == bound_sockets_.end()) 300 if (it == bound_sockets_.end())
301 return command->InternalErrorResponse("Port is not bound"); 301 return command->InternalErrorResponse("Port is not bound");
302 302
303 delete it->second; 303 delete it->second;
304 bound_sockets_.erase(it); 304 bound_sockets_.erase(it);
305 return command->SuccessResponse(NULL); 305 return command->SuccessResponse(NULL);
306 } 306 }
307 307
308 } // namespace content 308 } // namespace content
OLDNEW
« no previous file with comments | « chrome/browser/devtools/device/port_forwarding_controller.cc ('k') | net/socket/stream_listen_socket.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698