Try another approach...

This commit is contained in:
Adam Ierymenko 2020-11-18 22:26:06 -05:00
parent ca428233ba
commit 414c248cc5
No known key found for this signature in database
GPG key ID: C8877CF2D7A5D7F3

View file

@ -184,13 +184,14 @@ LinuxEthernetTap::LinuxEthernetTap(
(void)::pipe(_shutdownSignalPipe);
_tapReaderThread = std::thread([this]{
for(unsigned int t=0;t<2;++t) {
_tapReaderThread = std::thread([this, t]{
fd_set readfds,nullfds;
int n,nfds,r;
void *buf = nullptr;
std::vector<void *> buffers;
{
if (t == 0) {
struct ifreq ifr;
memset(&ifr,0,sizeof(ifr));
strcpy(ifr.ifr_name,_dev.c_str());
@ -235,6 +236,8 @@ LinuxEthernetTap::LinuxEthernetTap(
fcntl(_fd,F_SETFL,O_NONBLOCK);
::close(sock);
} else {
usleep(1500000);
}
FD_ZERO(&readfds);
@ -296,6 +299,7 @@ LinuxEthernetTap::LinuxEthernetTap(
}
}
});
}
_tapProcessorThread = std::thread([this] {
MAC to,from;