net/UniqueSocketDescriptor: add method MoveToFileDescriptor()
This commit is contained in:
parent
d563f5fc87
commit
011b96ff98
@ -5,6 +5,10 @@
|
||||
|
||||
#include "SocketDescriptor.hxx"
|
||||
|
||||
#ifndef _WIN32
|
||||
#include "io/UniqueFileDescriptor.hxx"
|
||||
#endif
|
||||
|
||||
#include <utility>
|
||||
|
||||
class StaticSocketAddress;
|
||||
@ -47,6 +51,12 @@ public:
|
||||
return std::exchange(*(SocketDescriptor *)this, Undefined());
|
||||
}
|
||||
|
||||
#ifndef _WIN32
|
||||
UniqueFileDescriptor MoveToFileDescriptor() && noexcept {
|
||||
return UniqueFileDescriptor{Release().ToFileDescriptor()};
|
||||
}
|
||||
#endif
|
||||
|
||||
UniqueSocketDescriptor &operator=(UniqueSocketDescriptor &&src) noexcept {
|
||||
using std::swap;
|
||||
swap(fd, src.fd);
|
||||
|
Loading…
Reference in New Issue
Block a user