@@ -291,7 +291,7 @@ template <typename H> inline H AbslHashValue(H h, const SocketAddress &a) {
291291// This is a general socket initialized with a file descriptor. Subclasses
292292// implement the different socket types.
293293class Socket {
294- public :
294+ protected :
295295 Socket () = default ;
296296 explicit Socket (int fd, bool connected = false )
297297 : fd_(fd), connected_(connected) {}
@@ -307,6 +307,7 @@ class Socket {
307307 return *this ;
308308 }
309309 ~Socket () {}
310+ public:
310311
311312 void Close () {
312313 fd_.Close ();
@@ -363,12 +364,6 @@ class UnixSocket : public Socket {
363364public:
364365 UnixSocket ();
365366 explicit UnixSocket (int fd, bool connected = false ) : Socket(fd, connected) {}
366- UnixSocket (UnixSocket &&s) : Socket(std::move(s)) {}
367- UnixSocket (const UnixSocket &s) = default ;
368- UnixSocket &operator =(const UnixSocket &s) = default ;
369- UnixSocket &operator =(UnixSocket &&s) = default ;
370-
371- ~UnixSocket () = default ;
372367
373368 absl::Status Bind (const std::string &pathname, bool listen);
374369 absl::Status Connect (const std::string &pathname);
@@ -391,16 +386,11 @@ class UnixSocket : public Socket {
391386// A socket for communication across the network. This is the base
392387// class for UDP and TCP sockets.
393388class NetworkSocket : public Socket {
394- public :
389+ protected :
395390 NetworkSocket () = default ;
396391 explicit NetworkSocket (int fd, bool connected = false )
397392 : Socket(fd, connected) {}
398- NetworkSocket (const NetworkSocket &s)
399- : Socket(s), bound_address_(s.bound_address_) {}
400- NetworkSocket (NetworkSocket &&s)
401- : Socket(std::move(s)), bound_address_(std::move(s.bound_address_)) {}
402- ~NetworkSocket () = default ;
403- NetworkSocket &operator =(const NetworkSocket &s) = default ;
393+ public:
404394
405395 absl::Status Connect (const InetAddress &addr);
406396
@@ -419,10 +409,6 @@ class UDPSocket : public NetworkSocket {
419409 UDPSocket ();
420410 explicit UDPSocket (int fd, bool connected = false )
421411 : NetworkSocket(fd, connected) {}
422- UDPSocket (const UDPSocket &) = default ;
423- UDPSocket (UDPSocket &&s) : NetworkSocket(std::move(s)) {}
424- ~UDPSocket () = default ;
425- UDPSocket &operator =(const UDPSocket &s) = default ;
426412
427413 absl::Status Bind (const InetAddress &addr);
428414
@@ -448,10 +434,6 @@ class TCPSocket : public NetworkSocket {
448434 TCPSocket ();
449435 explicit TCPSocket (int fd, bool connected = false )
450436 : NetworkSocket(fd, connected) {}
451- TCPSocket (const TCPSocket &) = default ;
452- TCPSocket (TCPSocket &&s) : NetworkSocket(std::move(s)) {}
453- ~TCPSocket () = default ;
454- TCPSocket &operator =(const TCPSocket &s) = default ;
455437
456438 absl::Status Bind (const InetAddress &addr, bool listen);
457439
@@ -467,10 +449,7 @@ class VirtualStreamSocket : public Socket {
467449 VirtualStreamSocket ();
468450 explicit VirtualStreamSocket (int fd, bool connected = false )
469451 : Socket(fd, connected) {}
470- VirtualStreamSocket (const VirtualStreamSocket &) = default ;
471- VirtualStreamSocket (VirtualStreamSocket &&s) : Socket(std::move(s)) {}
472- ~VirtualStreamSocket () = default ;
473- VirtualStreamSocket &operator =(const VirtualStreamSocket &s) = default ;
452+
474453 absl::Status Connect (const VirtualAddress &addr);
475454
476455 absl::Status Bind (const VirtualAddress &addr, bool listen);
@@ -496,6 +475,7 @@ class StreamSocket {
496475 StreamSocket (StreamSocket &&s) = default ;
497476 ~StreamSocket () = default ;
498477 StreamSocket &operator =(const StreamSocket &s) = default ;
478+ StreamSocket &operator =(StreamSocket &&s) = default ;
499479
500480 // Binders for TCP, Virtual, and Unix sockets.
501481 //
0 commit comments