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

Unified Diff: jingle/notifier/base/chrome_async_socket.h

Issue 10389098: [Sync] Make ChromeAsyncSocket use only the hostname on connect (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | jingle/notifier/base/chrome_async_socket.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: jingle/notifier/base/chrome_async_socket.h
diff --git a/jingle/notifier/base/chrome_async_socket.h b/jingle/notifier/base/chrome_async_socket.h
index d2df8df8cf15d377b0a091264c9132c54bfdeaae..8cf8e8da6228ebe6cf8ac5844abca2fadfc0ca27 100644
--- a/jingle/notifier/base/chrome_async_socket.h
+++ b/jingle/notifier/base/chrome_async_socket.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -34,10 +34,11 @@ class ResolvingClientSocketFactory;
class ChromeAsyncSocket : public buzz::AsyncSocket {
public:
- // Takes ownership of |client_socket_factory|.
- ChromeAsyncSocket(ResolvingClientSocketFactory* client_socket_factory,
- size_t read_buf_size,
- size_t write_buf_size);
+ // Takes ownership of |resolving_client_socket_factory|.
+ ChromeAsyncSocket(
+ ResolvingClientSocketFactory* resolving_client_socket_factory,
+ size_t read_buf_size,
+ size_t write_buf_size);
// Does not raise any signals.
virtual ~ChromeAsyncSocket();
@@ -62,8 +63,11 @@ class ChromeAsyncSocket : public buzz::AsyncSocket {
// If state() is not STATE_CLOSED, sets error to ERROR_WRONGSTATE
// and returns false.
//
- // If |address| is not resolved, sets error to ERROR_DNS and returns
- // false.
+ // If |address| has an empty hostname or a zero port, sets error to
+ // ERROR_DNS and returns false. (We don't use the IP address even
+ // if it's present, as DNS resolution is done by
+ // |resolving_client_socket_factory_|. But it's perfectly fine if
+ // the hostname is a stringified IP address.)
//
// Otherwise, starts the connection process and returns true.
// SignalConnected will be raised when the connection is successful;
@@ -176,19 +180,15 @@ class ChromeAsyncSocket : public buzz::AsyncSocket {
// Close functions.
void DoClose();
- scoped_ptr<ResolvingClientSocketFactory> client_socket_factory_;
+ base::WeakPtrFactory<ChromeAsyncSocket> weak_ptr_factory_;
+ scoped_ptr<ResolvingClientSocketFactory> resolving_client_socket_factory_;
// buzz::AsyncSocket state.
buzz::AsyncSocket::State state_;
buzz::AsyncSocket::Error error_;
net::Error net_error_;
- // Used by read/write loops.
- base::WeakPtrFactory<ChromeAsyncSocket> weak_factory_;
-
// NULL iff state() == STATE_CLOSED.
- //
- // TODO(akalin): Use ClientSocketPool.
scoped_ptr<net::StreamSocket> transport_socket_;
// State for the read loop. |read_start_| <= |read_end_| <=
« no previous file with comments | « no previous file | jingle/notifier/base/chrome_async_socket.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698