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

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: Revert the behavior change of calling RecordFastOpenStatus() Created 6 years, 5 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..941dca9ab53ba1a4cb3214712a4ae7e16cf7ee62 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,18 @@ 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) {
+ addr_len = other.addr_len;
+ // addr is already set to &this->addr_storage by default ctor.
+ 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,
« device/bluetooth/bluetooth_socket_net.cc ('K') | « net/base/net_util.h ('k') | net/net.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698