From fe89ea7e351d304ca379125329018f5b96a2aded Mon Sep 17 00:00:00 2001 From: "eroman@chromium.org" Date: Thu, 12 May 2011 02:02:40 +0000 Subject: Miscelaneous cleanups to AddressList to make it harder to mis-use. - Removed all destructive non-const member functions -- these were dangerous since if you called them without first making a copy of the AddressList, it could mutate earlier copies. - Made AddressList::Data::head const, so new code added to AddressList cannot inadvertently introduce such dangerous mutations (won't compile). - Moved the non-trivial constructors and assign methods into factory methods (for added readability) - Removed the bool parameter from Copy (for added readability). Review URL: http://codereview.chromium.org/6880302 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85090 0039d316-1c4b-4281-b951-d872f2087c98 --- net/socket/tcp_client_socket_libevent.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'net/socket/tcp_client_socket_libevent.cc') diff --git a/net/socket/tcp_client_socket_libevent.cc b/net/socket/tcp_client_socket_libevent.cc index d386bae..6e0cb1c 100644 --- a/net/socket/tcp_client_socket_libevent.cc +++ b/net/socket/tcp_client_socket_libevent.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. @@ -615,7 +615,7 @@ int TCPClientSocketLibevent::GetPeerAddress(AddressList* address) const { DCHECK(address); if (!IsConnected()) return ERR_SOCKET_NOT_CONNECTED; - address->Copy(current_ai_, false); + *address = AddressList::CreateByCopyingFirstAddress(current_ai_); return OK; } -- cgit v1.1