From 534643aac6c556ee5f9e83a5ef248979913941ad Mon Sep 17 00:00:00 2001 From: dmiller Date: Wed, 26 Sep 2018 21:12:40 +0000 Subject: [PATCH] Performance tweak for Windows. See #1327 --- libnetutil/netutil.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libnetutil/netutil.cc b/libnetutil/netutil.cc index c7dfa5be8..31de2aff4 100644 --- a/libnetutil/netutil.cc +++ b/libnetutil/netutil.cc @@ -4153,7 +4153,11 @@ pcap_t *my_pcap_open_live(const char *device, int snaplen, int promisc, int to_m /* This is unnecessary with Npcap since libpcap calls PacketSetMinToCopy(0) * based on immediate mode. Have not determined if it is needed for WinPcap * or not, but it's not hurting anything. */ - pcap_setmintocopy(pt, 1); + pcap_setmintocopy(pt, 0); + /* Npcap sets kernel buffer size to 1MB, but user buffer size to 256KB. + * Memory is pretty cheap these days, so lets match the kernel buffer size + * for better performance. */ + pcap_setuserbuffer(pt, 1000000); #endif return pt;