mirror of
https://github.com/intrepidcs/libicsneo.git
synced 2026-08-05 01:18:36 +02:00
Driver: PCAP: Properly handle RX timeout
If res == 0 the header and data will not be populated because no message was RXed.
This commit is contained in:
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user