Chromium Code Reviews| Index: chrome/browser/extensions/api/socket/tcp_socket.cc |
| diff --git a/chrome/browser/extensions/api/socket/tcp_socket.cc b/chrome/browser/extensions/api/socket/tcp_socket.cc |
| index 4f9273468ab31690db5401025e197e63b9aa6cb3..94da9cfbf25a1656b88760922af5671db754856f 100644 |
| --- a/chrome/browser/extensions/api/socket/tcp_socket.cc |
| +++ b/chrome/browser/extensions/api/socket/tcp_socket.cc |
| @@ -306,6 +306,38 @@ void TCPSocket::OnAccept(int result) { |
| accept_callback_.Reset(); |
| } |
| +void TCPSocket::Release() { |
| + // Release() is only invoked when the underlying sockets are taken (via |
| + // ClientStream()) by TLSSocket. TLSSocket only supports CLIENT-mode |
| + // sockets. |
| + |
| + DCHECK(!server_socket_.release() && !accept_socket_.release()) |
| + << "TCPSocket::Release called in server mode."; |
| + |
| + DCHECK(socket_mode_ == CLIENT); |
| + |
| + // Release() doesn't disconnect the underlying sockets, but it does |
| + // disconnect them from this TCPSocket. |
| + is_connected_ = false; |
| + |
| + connect_callback_.Reset(); |
| + read_callback_.Reset(); |
| + accept_callback_.Reset(); |
| + |
| + DCHECK(socket_.release() != NULL) |
|
Ryan Sleevi
2014/03/12 23:35:27
SECURITY BUG: This will not actually release socke
lally
2014/03/17 01:58:06
Yikes. Fixed.
|
| + << "TCPSocket::Release on null client socket."; |
| +} |
| + |
| +net::TCPClientSocket* TCPSocket::ClientStream() { |
| + if (socket_mode_ != CLIENT || GetSocketType() != TYPE_TCP) |
| + return NULL; |
| + return socket_.get(); |
| +} |
| + |
| +bool TCPSocket::HasPendingRead() const { |
| + return !read_callback_.is_null(); |
| +} |
| + |
| ResumableTCPSocket::ResumableTCPSocket(const std::string& owner_extension_id) |
| : TCPSocket(owner_extension_id), |
| persistent_(false), |