net/SocketDescriptor: add Duplicate() method
The the Duplicate() method we inherited from class FileDescriptor returns a UniqueFileDescriptor, but we really want to return a UniqueSocketDescriptor.
This commit is contained in:

committed by
Max Kellermann

parent
dbb2b29271
commit
314667259e
@@ -6,6 +6,7 @@
|
||||
#include "StaticSocketAddress.hxx"
|
||||
#include "IPv4Address.hxx"
|
||||
#include "IPv6Address.hxx"
|
||||
#include "UniqueSocketDescriptor.hxx"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <ws2tcpip.h>
|
||||
@@ -243,7 +244,15 @@ SocketDescriptor::SetNonBlocking() const noexcept
|
||||
return ioctlsocket(fd, FIONBIO, &val) == 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
#else
|
||||
|
||||
UniqueSocketDescriptor
|
||||
SocketDescriptor::Duplicate() const noexcept
|
||||
{
|
||||
return UniqueSocketDescriptor{FileDescriptor::Duplicate()};
|
||||
}
|
||||
|
||||
#endif // !_WIN32
|
||||
|
||||
bool
|
||||
SocketDescriptor::SetOption(int level, int name,
|
||||
|
Reference in New Issue
Block a user