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

Unified Diff: libraries/nacl-mounts/net/TcpSocket.cc

Issue 10556007: changes in memory mount and socket subsystem to port thttpd (Closed) Base URL: http://naclports.googlecode.com/svn/trunk/src/
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « libraries/nacl-mounts/net/TcpSocket.h ('k') | libraries/nacl-mounts/net/newlib_compat.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: libraries/nacl-mounts/net/TcpSocket.cc
===================================================================
--- libraries/nacl-mounts/net/TcpSocket.cc (revision 598)
+++ libraries/nacl-mounts/net/TcpSocket.cc (working copy)
@@ -9,6 +9,7 @@
#include "../net/SocketSubSystem.h"
#include "ppapi/c/pp_errors.h"
#include "ppapi/cpp/module.h"
+#include "ppapi/cpp/private/net_address_private.h"
#include "../util/DebugPrint.h"
#include "../util/PthreadHelpers.h"
@@ -162,6 +163,31 @@
}
}
+void TCPSocket::GetAddress(struct sockaddr* addr) {
+ struct sockaddr_in* iaddr = (struct sockaddr_in*) addr;
+ struct sockaddr_in6* iaddr6 = (struct sockaddr_in6*) addr;
+ PP_NetAddress_Private netaddr;
+ socket_->GetRemoteAddress(&netaddr);
+ PP_NetAddressFamily_Private family =
+ pp::NetAddressPrivate::GetFamily(netaddr);
+ if (family == PP_NETADDRESSFAMILY_IPV4)
+ iaddr->sin_family = AF_INET;
+ else if (family == PP_NETADDRESSFAMILY_IPV6)
+ iaddr->sin_family = AF_INET6;
+ else {
+ iaddr->sin_family = AF_UNSPEC;
+ return;
+ }
+ iaddr6->sin6_port = pp::NetAddressPrivate::GetPort(netaddr);
+ if (family == PP_NETADDRESSFAMILY_IPV6) {
+ pp::NetAddressPrivate::GetAddress(
+ netaddr, &iaddr6->sin6_addr, sizeof(in6_addr));
+ } else {
+ pp::NetAddressPrivate::GetAddress(
+ netaddr, &iaddr->sin_addr, sizeof(in_addr));
+ }
+}
+
void TCPSocket::OnConnect(int32_t result, int32_t* pres) {
SimpleAutoLock lock(sys_->mutex());
if (result == PP_OK) {
« no previous file with comments | « libraries/nacl-mounts/net/TcpSocket.h ('k') | libraries/nacl-mounts/net/newlib_compat.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698