Add StealFd

This commit is contained in:
Ludvig Strigeus 2018-12-15 22:06:04 +01:00
parent a4361e24e2
commit 7736cc700f
2 changed files with 7 additions and 0 deletions

View file

@ -286,6 +286,12 @@ void BaseSocketBsd::AddToEndLoop() {
network_->endloop_[endloop_slot_ = network_->num_endloop_++] = this;
}
int BaseSocketBsd::StealFd() {
int fd = exch(fd_, -1);
CloseSocket();
return fd;
}
//////////////////////////////////////////////////////////////////////////////////////////////
TunSocketBsd::TunSocketBsd(NetworkBsd *network, WireguardProcessor *processor)

View file

@ -101,6 +101,7 @@ public:
void AddToEndLoop();
int GetFd() { return fd_; }
int StealFd();
protected:
void SetPollFlags(int events) {