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

Side by Side Diff: content/browser/renderer_host/p2p/socket_host_tcp_server.cc

Issue 10491007: fixed issue 128383 - replace GetPeerAddress(AddressList* address) with GetPeerAddress(IPEndPoint* a… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix according to review Created 8 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | content/browser/renderer_host/p2p/socket_host_test_utils.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/renderer_host/p2p/socket_host_tcp_server.h" 5 #include "content/browser/renderer_host/p2p/socket_host_tcp_server.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "content/browser/renderer_host/p2p/socket_host_tcp.h" 10 #include "content/browser/renderer_host/p2p/socket_host_tcp.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 } 87 }
88 } 88 }
89 89
90 void P2PSocketHostTcpServer::HandleAcceptResult(int result) { 90 void P2PSocketHostTcpServer::HandleAcceptResult(int result) {
91 if (result < 0) { 91 if (result < 0) {
92 if (result != net::ERR_IO_PENDING) 92 if (result != net::ERR_IO_PENDING)
93 OnError(); 93 OnError();
94 return; 94 return;
95 } 95 }
96 96
97 net::AddressList addr_list; 97 net::IPEndPoint address;
98 if (accept_socket_->GetPeerAddress(&addr_list) != net::OK) { 98 if (accept_socket_->GetPeerAddress(&address) != net::OK) {
99 LOG(ERROR) << "Failed to get address of an accepted socket."; 99 LOG(ERROR) << "Failed to get address of an accepted socket.";
100 accept_socket_.reset(); 100 accept_socket_.reset();
101 return; 101 return;
102 } 102 }
103 const net::IPEndPoint& address = addr_list.front();
104 AcceptedSocketsMap::iterator it = accepted_sockets_.find(address); 103 AcceptedSocketsMap::iterator it = accepted_sockets_.find(address);
105 if (it != accepted_sockets_.end()) 104 if (it != accepted_sockets_.end())
106 delete it->second; 105 delete it->second;
107 106
108 accepted_sockets_[address] = accept_socket_.release(); 107 accepted_sockets_[address] = accept_socket_.release();
109 message_sender_->Send( 108 message_sender_->Send(
110 new P2PMsg_OnIncomingTcpConnection(routing_id_, id_, address)); 109 new P2PMsg_OnIncomingTcpConnection(routing_id_, id_, address));
111 } 110 }
112 111
113 void P2PSocketHostTcpServer::OnAccepted(int result) { 112 void P2PSocketHostTcpServer::OnAccepted(int result) {
(...skipping 18 matching lines...) Expand all
132 accepted_sockets_.erase(it); 131 accepted_sockets_.erase(it);
133 scoped_ptr<P2PSocketHostTcp> result( 132 scoped_ptr<P2PSocketHostTcp> result(
134 new P2PSocketHostTcp(message_sender_, routing_id_, id)); 133 new P2PSocketHostTcp(message_sender_, routing_id_, id));
135 if (!result->InitAccepted(remote_address, socket)) 134 if (!result->InitAccepted(remote_address, socket))
136 return NULL; 135 return NULL;
137 136
138 return result.release(); 137 return result.release();
139 } 138 }
140 139
141 } // namespace content 140 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/renderer_host/p2p/socket_host_test_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698