File tree 3 files changed +16
-2
lines changed
3 files changed +16
-2
lines changed Original file line number Diff line number Diff line change 6
6
#include " StaticSocketAddress.hxx"
7
7
#include " IPv4Address.hxx"
8
8
#include " IPv6Address.hxx"
9
+ #include " UniqueSocketDescriptor.hxx"
9
10
10
11
#ifdef _WIN32
11
12
#include < ws2tcpip.h>
@@ -243,7 +244,15 @@ SocketDescriptor::SetNonBlocking() const noexcept
243
244
return ioctlsocket (fd, FIONBIO, &val) == 0 ;
244
245
}
245
246
246
- #endif
247
+ #else
248
+
249
+ UniqueSocketDescriptor
250
+ SocketDescriptor::Duplicate () const noexcept
251
+ {
252
+ return UniqueSocketDescriptor{FileDescriptor::Duplicate ()};
253
+ }
254
+
255
+ #endif // !_WIN32
247
256
248
257
bool
249
258
SocketDescriptor::SetOption (int level, int name,
Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ class SocketAddress;
24
24
class StaticSocketAddress ;
25
25
class IPv4Address ;
26
26
class IPv6Address ;
27
+ class UniqueSocketDescriptor ;
27
28
28
29
/* *
29
30
* An OO wrapper for a Berkeley or WinSock socket descriptor.
@@ -137,7 +138,10 @@ public:
137
138
138
139
using FileDescriptor::SetNonBlocking;
139
140
using FileDescriptor::SetBlocking;
140
- using FileDescriptor::Duplicate;
141
+
142
+ [[nodiscard]]
143
+ UniqueSocketDescriptor Duplicate () const noexcept ;
144
+
141
145
using FileDescriptor::CheckDuplicate;
142
146
using FileDescriptor::Close;
143
147
#else
Original file line number Diff line number Diff line change @@ -23,5 +23,6 @@ net_dep = declare_dependency(
23
23
link_with : net,
24
24
dependencies : [
25
25
system_dep,
26
+ io_dep,
26
27
],
27
28
)
You can’t perform that action at this time.
0 commit comments