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

Unified Diff: net/base/net_util.cc

Issue 348803003: Refactor tcp socket and unix domain socket. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments and fixed unittests for chrome os. Created 6 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
Index: net/base/net_util.cc
diff --git a/net/base/net_util.cc b/net/base/net_util.cc
index 5b3d65e515b2a060c9eabc31458b3dde0b156e32..2142e2a838d7ec86716143aef8f39e144af6ae17 100644
--- a/net/base/net_util.cc
+++ b/net/base/net_util.cc
@@ -5,6 +5,7 @@
#include "net/base/net_util.h"
#include <errno.h>
+#include <string.h>
#include <algorithm>
#include <iterator>
@@ -501,6 +502,17 @@ bool IsIPAddressReserved(const IPAddressNumber& host_addr) {
return false;
}
+SockaddrStorage::SockaddrStorage(const SockaddrStorage& other)
+ : addr_len(other.addr_len),
+ addr(reinterpret_cast<struct sockaddr*>(&addr_storage)) {
+ memcpy(addr, other.addr, addr_len);
+}
+
+void SockaddrStorage::operator=(const SockaddrStorage& other) {
mmenke 2014/06/30 18:26:51 Ahh...right. Mind adding a comment along those li
byungchul 2014/06/30 19:38:34 Done.
+ addr_len = other.addr_len;
+ memcpy(addr, other.addr, addr_len);
+}
+
// Extracts the address and port portions of a sockaddr.
bool GetIPAddressFromSockAddr(const struct sockaddr* sock_addr,
socklen_t sock_addr_len,
« no previous file with comments | « net/base/net_util.h ('k') | net/net.gyp » ('j') | net/socket/socket_libevent.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698