Add batched recv/send to WinDivert (#156).
This change allows multiple packets to be received/sent at once, reducing overheads. To exploit this feature, applications need to use the WinDivertRecvEx()/WinDivertSendEx() functions with the new addrLen parameter. The passthru example has been modified to use batching. The DEBUG flag has been retired since it conflicts with batching, and was not very useful anyway.
This commit is contained in:
+2
-2
@@ -319,7 +319,7 @@ int main(void)
|
||||
// (1) stop normal traffic from interacting with the tests; and
|
||||
// (2) stop test packets escaping to the Internet or TCP/IP stack.
|
||||
upper_handle = WinDivertOpen("true", WINDIVERT_LAYER_NETWORK, -510,
|
||||
WINDIVERT_FLAG_DROP | WINDIVERT_FLAG_DEBUG);
|
||||
WINDIVERT_FLAG_DROP);
|
||||
lower_handle = WinDivertOpen("true", WINDIVERT_LAYER_NETWORK, 510,
|
||||
WINDIVERT_FLAG_DROP);
|
||||
if (upper_handle == INVALID_HANDLE_VALUE ||
|
||||
@@ -468,7 +468,7 @@ static BOOL run_test(HANDLE inject_handle, const char *filter,
|
||||
goto failed;
|
||||
}
|
||||
overlapped.hEvent = event;
|
||||
if (!WinDivertRecvEx(handle, buf, sizeof(buf), 0, &addr, &buf_len,
|
||||
if (!WinDivertRecvEx(handle, buf, sizeof(buf), &buf_len, 0, &addr, NULL,
|
||||
&overlapped))
|
||||
{
|
||||
if (GetLastError() != ERROR_IO_PENDING)
|
||||
|
||||
Reference in New Issue
Block a user