mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-06 20:43:44 +02:00
Try another approach...
This commit is contained in:
parent
ca428233ba
commit
414c248cc5
1 changed files with 102 additions and 98 deletions
|
@ -184,13 +184,14 @@ LinuxEthernetTap::LinuxEthernetTap(
|
||||||
|
|
||||||
(void)::pipe(_shutdownSignalPipe);
|
(void)::pipe(_shutdownSignalPipe);
|
||||||
|
|
||||||
_tapReaderThread = std::thread([this]{
|
for(unsigned int t=0;t<2;++t) {
|
||||||
|
_tapReaderThread = std::thread([this, t]{
|
||||||
fd_set readfds,nullfds;
|
fd_set readfds,nullfds;
|
||||||
int n,nfds,r;
|
int n,nfds,r;
|
||||||
void *buf = nullptr;
|
void *buf = nullptr;
|
||||||
std::vector<void *> buffers;
|
std::vector<void *> buffers;
|
||||||
|
|
||||||
{
|
if (t == 0) {
|
||||||
struct ifreq ifr;
|
struct ifreq ifr;
|
||||||
memset(&ifr,0,sizeof(ifr));
|
memset(&ifr,0,sizeof(ifr));
|
||||||
strcpy(ifr.ifr_name,_dev.c_str());
|
strcpy(ifr.ifr_name,_dev.c_str());
|
||||||
|
@ -235,6 +236,8 @@ LinuxEthernetTap::LinuxEthernetTap(
|
||||||
fcntl(_fd,F_SETFL,O_NONBLOCK);
|
fcntl(_fd,F_SETFL,O_NONBLOCK);
|
||||||
|
|
||||||
::close(sock);
|
::close(sock);
|
||||||
|
} else {
|
||||||
|
usleep(1500000);
|
||||||
}
|
}
|
||||||
|
|
||||||
FD_ZERO(&readfds);
|
FD_ZERO(&readfds);
|
||||||
|
@ -296,6 +299,7 @@ LinuxEthernetTap::LinuxEthernetTap(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
_tapProcessorThread = std::thread([this] {
|
_tapProcessorThread = std::thread([this] {
|
||||||
MAC to,from;
|
MAC to,from;
|
||||||
|
|
Loading…
Add table
Reference in a new issue