summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuy Harris <gharris@sonic.net>2020-05-30 01:10:49 -0700
committerGuy Harris <gharris@sonic.net>2020-05-30 01:10:49 -0700
commit5e479b12633a328e9c51863c1c17418452e16bd2 (patch)
treec10dd13fe62ae391f52aea493c9ac4107b12f65c
parent4a7a2292f9210624a03d3407afbdecd593edcfb7 (diff)
downloadlibpcap-5e479b12633a328e9c51863c1c17418452e16bd2.tar.gz
airpcap: have our own breakloop routine.
Have it set the read event, just as the NPF code does, so that, if we're blocking on a read, pcap_breakloop will wake us up.
-rw-r--r--pcap-airpcap.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/pcap-airpcap.c b/pcap-airpcap.c
index 8693a9d4..6b607162 100644
--- a/pcap-airpcap.c
+++ b/pcap-airpcap.c
@@ -728,6 +728,24 @@ airpcap_cleanup(pcap_t *p)
pcap_cleanup_live_common(p);
}
+static void
+airpcap_breakloop(pcap_t *p)
+{
+ HANDLE read_event;
+
+ pcap_breakloop_common(p);
+ struct pcap_airpcap *pa = p->priv;
+
+ /* XXX - what if either of these fail? */
+ /*
+ * XXX - will SetEvent() force a wakeup and, if so, will
+ * the AirPcap read code handle that sanely?
+ */
+ if (!p_AirpcapGetReadEvent(pa->adapter, &read_event))
+ return;
+ SetEvent(read_event);
+}
+
static int
airpcap_activate(pcap_t *p)
{
@@ -885,6 +903,7 @@ airpcap_activate(pcap_t *p)
p->set_datalink_op = airpcap_set_datalink;
p->getnonblock_op = airpcap_getnonblock;
p->setnonblock_op = airpcap_setnonblock;
+ p->breakloop_op = airpcap_breakloop;
p->stats_op = airpcap_stats;
p->stats_ex_op = airpcap_stats_ex;
p->setbuff_op = airpcap_setbuff;