mirror of
https://github.com/python/cpython.git
synced 2025-10-16 19:57:59 +00:00
Issue #26536: socket.ioctl now supports SIO_LOOPBACK_FAST_PATH. Patch by Daniel Stokes.
This commit is contained in:
parent
99d66f917a
commit
ea93ac013d
6 changed files with 57 additions and 4 deletions
|
@ -4053,6 +4053,17 @@ sock_ioctl(PySocketSockObject *s, PyObject *arg)
|
|||
return set_error();
|
||||
}
|
||||
return PyLong_FromUnsignedLong(recv); }
|
||||
#if defined(SIO_LOOPBACK_FAST_PATH)
|
||||
case SIO_LOOPBACK_FAST_PATH: {
|
||||
unsigned int option;
|
||||
if (!PyArg_ParseTuple(arg, "kI:ioctl", &cmd, &option))
|
||||
return NULL;
|
||||
if (WSAIoctl(s->sock_fd, cmd, &option, sizeof(option),
|
||||
NULL, 0, &recv, NULL, NULL) == SOCKET_ERROR) {
|
||||
return set_error();
|
||||
}
|
||||
return PyLong_FromUnsignedLong(recv); }
|
||||
#endif
|
||||
default:
|
||||
PyErr_Format(PyExc_ValueError, "invalid ioctl command %d", cmd);
|
||||
return NULL;
|
||||
|
@ -4063,7 +4074,8 @@ PyDoc_STRVAR(sock_ioctl_doc,
|
|||
\n\
|
||||
Control the socket with WSAIoctl syscall. Currently supported 'cmd' values are\n\
|
||||
SIO_RCVALL: 'option' must be one of the socket.RCVALL_* constants.\n\
|
||||
SIO_KEEPALIVE_VALS: 'option' is a tuple of (onoff, timeout, interval).");
|
||||
SIO_KEEPALIVE_VALS: 'option' is a tuple of (onoff, timeout, interval).\n\
|
||||
SIO_LOOPBACK_FAST_PATH: 'option' is a boolean value, and is disabled by default");
|
||||
#endif
|
||||
|
||||
#if defined(MS_WINDOWS)
|
||||
|
@ -7274,8 +7286,16 @@ PyInit__socket(void)
|
|||
|
||||
#ifdef SIO_RCVALL
|
||||
{
|
||||
DWORD codes[] = {SIO_RCVALL, SIO_KEEPALIVE_VALS};
|
||||
const char *names[] = {"SIO_RCVALL", "SIO_KEEPALIVE_VALS"};
|
||||
DWORD codes[] = {SIO_RCVALL, SIO_KEEPALIVE_VALS,
|
||||
#if defined(SIO_LOOPBACK_FAST_PATH)
|
||||
SIO_LOOPBACK_FAST_PATH
|
||||
#endif
|
||||
};
|
||||
const char *names[] = {"SIO_RCVALL", "SIO_KEEPALIVE_VALS",
|
||||
#if defined(SIO_LOOPBACK_FAST_PATH)
|
||||
"SIO_LOOPBACK_FAST_PATH"
|
||||
#endif
|
||||
};
|
||||
int i;
|
||||
for(i = 0; i<Py_ARRAY_LENGTH(codes); ++i) {
|
||||
PyObject *tmp;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue