Add StealFd
This commit is contained in:
parent
a4361e24e2
commit
7736cc700f
2 changed files with 7 additions and 0 deletions
|
@ -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)
|
||||
|
|
|
@ -101,6 +101,7 @@ public:
|
|||
void AddToEndLoop();
|
||||
|
||||
int GetFd() { return fd_; }
|
||||
int StealFd();
|
||||
|
||||
protected:
|
||||
void SetPollFlags(int events) {
|
||||
|
|
Loading…
Reference in a new issue