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

Unified Diff: content/browser/renderer_host/pepper_udp_socket.cc

Issue 9212047: Add GetBoundAddress to PPB_UDPSocket_Private (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Add GetBoundAddress to retrieve address we bound to. Created 8 years, 11 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
Index: content/browser/renderer_host/pepper_udp_socket.cc
diff --git a/content/browser/renderer_host/pepper_udp_socket.cc b/content/browser/renderer_host/pepper_udp_socket.cc
index 33f2c7f0c17199eef6e047f4680cc5ea250c975b..b82d2e7de407cacc8612b8602dd2d94c89479717 100644
--- a/content/browser/renderer_host/pepper_udp_socket.cc
+++ b/content/browser/renderer_host/pepper_udp_socket.cc
@@ -49,6 +49,11 @@ void PepperUDPSocket::Bind(const PP_NetAddress_Private& addr) {
int result = socket_->Listen(address);
+ // If we are successful, get the local address we bound to.
+ if (result == net::OK) {
+ socket_->GetLocalAddress(&bound_address_);
+ }
+
SendBindACK(result == net::OK);
}
@@ -106,8 +111,11 @@ void PepperUDPSocket::SendSendToACKError() {
}
void PepperUDPSocket::SendBindACK(bool result) {
+ PP_NetAddress_Private addr = NetAddressPrivateImpl::kInvalidNetAddress;
+ NetAddressPrivateImpl::IPEndPointToNetAddress(bound_address_, &addr);
yzshen1 2012/02/06 06:51:27 nit: please check for failure as OnRecvFromComplet
mtilburg1 2012/02/06 15:11:35 Done.
+
manager_->Send(new PpapiMsg_PPBUDPSocket_BindACK(
- routing_id_, plugin_dispatcher_id_, socket_id_, result));
+ routing_id_, plugin_dispatcher_id_, socket_id_, result, addr));
}
void PepperUDPSocket::OnRecvFromCompleted(int result) {

Powered by Google App Engine
This is Rietveld 408576698