diff options
author | lazyboy <lazyboy@chromium.org> | 2016-03-12 15:05:36 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-03-12 23:07:28 +0000 |
commit | 2eb2d38dde83688f266012a04120c3253156d2b7 (patch) | |
tree | b012efb1fb44e65c0d824c46b32f59978ffd99b8 /extensions/browser/api | |
parent | f751bddca167a2ad293cd24d9772f745b5f30c39 (diff) | |
download | chromium_src-2eb2d38dde83688f266012a04120c3253156d2b7.zip chromium_src-2eb2d38dde83688f266012a04120c3253156d2b7.tar.gz chromium_src-2eb2d38dde83688f266012a04120c3253156d2b7.tar.bz2 |
Minor cleanup in TCPSocket code.
1. Simplify and remove do{}while(false); whose purpose is not clear to me.
2. Don't assign |connect_callack_| twice.
BUG=None
Test=None, compiles
Review URL: https://codereview.chromium.org/1793893002
Cr-Commit-Position: refs/heads/master@{#380884}
Diffstat (limited to 'extensions/browser/api')
-rw-r--r-- | extensions/browser/api/socket/tcp_socket.cc | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/extensions/browser/api/socket/tcp_socket.cc b/extensions/browser/api/socket/tcp_socket.cc index a69ed02..d4aaafb 100644 --- a/extensions/browser/api/socket/tcp_socket.cc +++ b/extensions/browser/api/socket/tcp_socket.cc @@ -97,17 +97,12 @@ void TCPSocket::Connect(const net::AddressList& address, connect_callback_ = callback; int result = net::ERR_CONNECTION_FAILED; - do { - if (is_connected_) - break; - + if (!is_connected_) { socket_.reset( new net::TCPClientSocket(address, NULL, net::NetLog::Source())); - - connect_callback_ = callback; result = socket_->Connect( base::Bind(&TCPSocket::OnConnectComplete, base::Unretained(this))); - } while (false); + } if (result != net::ERR_IO_PENDING) OnConnectComplete(result); |