Driver: PCAP: Properly handle RX timeout
If res == 0 the header and data will not be populated because no message was RXed.pull/56/head
parent
d9cdd03618
commit
cd7b0b0a7b
|
|
@ -140,6 +140,8 @@ void PCAP::Find(std::vector<FoundDevice>& found) {
|
|||
struct pcap_pkthdr* header;
|
||||
const uint8_t* data;
|
||||
auto res = pcap_next_ex(iface.fp, &header, &data);
|
||||
if(res == 0)
|
||||
continue;
|
||||
if(res < 0 || !header || !data) {
|
||||
if (!warned) {
|
||||
warned = true;
|
||||
|
|
@ -148,8 +150,6 @@ void PCAP::Find(std::vector<FoundDevice>& found) {
|
|||
}
|
||||
break;
|
||||
}
|
||||
if(res == 0)
|
||||
continue; // Keep waiting for that packet
|
||||
|
||||
EthernetPacketizer ethPacketizer([](APIEvent::Type, APIEvent::Severity) {});
|
||||
memcpy(ethPacketizer.hostMAC, iface.macAddress, sizeof(ethPacketizer.hostMAC));
|
||||
|
|
|
|||
Loading…
Reference in New Issue