xref: /aosp_15_r20/external/cronet/net/socket/socket.cc (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2017 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #include "net/socket/socket.h"
6 
7 #include <set>
8 
9 #include "net/base/net_errors.h"
10 
11 namespace net {
12 
13 Socket::Socket() = default;
14 
15 Socket::~Socket() = default;
16 
ReadIfReady(IOBuffer * buf,int buf_len,CompletionOnceCallback callback)17 int Socket::ReadIfReady(IOBuffer* buf,
18                         int buf_len,
19                         CompletionOnceCallback callback) {
20   return ERR_READ_IF_READY_NOT_IMPLEMENTED;
21 }
22 
CancelReadIfReady()23 int Socket::CancelReadIfReady() {
24   return ERR_READ_IF_READY_NOT_IMPLEMENTED;
25 }
26 
SetDnsAliases(std::set<std::string> aliases)27 void Socket::SetDnsAliases(std::set<std::string> aliases) {
28   if (aliases == std::set<std::string>({""})) {
29     // Reset field to empty vector. Necessary because some tests and other
30     // inputs still use a trivial canonical name of std::string().
31     dns_aliases_.clear();
32     return;
33   }
34 
35   dns_aliases_ = std::move(aliases);
36 }
37 
GetDnsAliases() const38 const std::set<std::string>& Socket::GetDnsAliases() const {
39   return dns_aliases_;
40 }
41 
42 }  // namespace net
43