Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
19e7d48c
Kaydet (Commit)
19e7d48c
authored
Şub 26, 2018
tarafından
animalize
Kaydeden (comit)
Steve Dower
Şub 26, 2018
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
bpo-32394: Remove some TCP options on old version Windows. (GH-5523)
üst
3f2e6f15
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
101 additions
and
0 deletions
+101
-0
socket.rst
Doc/library/socket.rst
+7
-0
test_socket.py
Lib/test/test_socket.py
+22
-0
2018-02-10-13-51-56.bpo-32394.dFM9SI.rst
...S.d/next/Library/2018-02-10-13-51-56.bpo-32394.dFM9SI.rst
+2
-0
socketmodule.c
Modules/socketmodule.c
+70
-0
No files found.
Doc/library/socket.rst
Dosyayı görüntüle @
19e7d48c
...
...
@@ -320,9 +320,16 @@ Constants
``SO_DOMAIN``, ``SO_PROTOCOL``, ``SO_PEERSEC``, ``SO_PASSSEC``,
``TCP_USER_TIMEOUT``, ``TCP_CONGESTION`` were added.
.. versionchanged:: 3.6.5
On Windows, ``TCP_FASTOPEN``, ``TCP_KEEPCNT`` appear if run-time Windows
supports.
.. versionchanged:: 3.7
``TCP_NOTSENT_LOWAT`` was added.
On Windows, ``TCP_KEEPIDLE``, ``TCP_KEEPINTVL`` appear if run-time Windows
supports.
.. data:: AF_CAN
PF_CAN
SOL_CAN_*
...
...
Lib/test/test_socket.py
Dosyayı görüntüle @
19e7d48c
...
...
@@ -5945,6 +5945,27 @@ class LinuxKernelCryptoAPI(unittest.TestCase):
with
self
.
assertRaises
(
TypeError
):
sock
.
sendmsg_afalg
(
op
=
socket
.
ALG_OP_ENCRYPT
,
assoclen
=-
1
)
@unittest.skipUnless
(
sys
.
platform
.
startswith
(
"win"
),
"requires Windows"
)
class
TestMSWindowsTCPFlags
(
unittest
.
TestCase
):
knownTCPFlags
=
{
# avaliable since long time ago
'TCP_MAXSEG'
,
'TCP_NODELAY'
,
# available starting with Windows 10 1607
'TCP_FASTOPEN'
,
# available starting with Windows 10 1703
'TCP_KEEPCNT'
,
# available starting with Windows 10 1709
'TCP_KEEPIDLE'
,
'TCP_KEEPINTVL'
}
def
test_new_tcp_flags
(
self
):
provided
=
[
s
for
s
in
dir
(
socket
)
if
s
.
startswith
(
'TCP'
)]
unknown
=
[
s
for
s
in
provided
if
s
not
in
self
.
knownTCPFlags
]
self
.
assertEqual
([],
unknown
,
"New TCP flags were discovered. See bpo-32394 for more information"
)
def
test_main
():
tests
=
[
GeneralModuleTests
,
BasicTCPTest
,
TCPCloserTest
,
TCPTimeoutTest
,
...
...
@@ -6005,6 +6026,7 @@ def test_main():
SendfileUsingSendTest
,
SendfileUsingSendfileTest
,
])
tests
.
append
(
TestMSWindowsTCPFlags
)
thread_info
=
support
.
threading_setup
()
support
.
run_unittest
(
*
tests
)
...
...
Misc/NEWS.d/next/Library/2018-02-10-13-51-56.bpo-32394.dFM9SI.rst
0 → 100644
Dosyayı görüntüle @
19e7d48c
socket: Remove TCP_FASTOPEN,TCP_KEEPCNT,TCP_KEEPIDLE,TCP_KEEPINTVL flags on
older version Windows during run-time.
Modules/socketmodule.c
Dosyayı görüntüle @
19e7d48c
...
...
@@ -305,6 +305,70 @@ http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libc/net/getaddrinfo.c.diff?r1=1.82&
/* Provides the IsWindows7SP1OrGreater() function */
#include <VersionHelpers.h>
/* remove some flags on older version Windows during run-time.
https://msdn.microsoft.com/en-us/library/windows/desktop/ms738596.aspx */
typedef
struct
{
DWORD
build_number
;
/* available starting with this Win10 BuildNumber */
const
char
flag_name
[
20
];
}
FlagRuntimeInfo
;
/* IMPORTANT: make sure the list ordered by descending build_number */
static
FlagRuntimeInfo
win_runtime_flags
[]
=
{
/* available starting with Windows 10 1709 */
{
16299
,
"TCP_KEEPIDLE"
},
{
16299
,
"TCP_KEEPINTVL"
},
/* available starting with Windows 10 1703 */
{
15063
,
"TCP_KEEPCNT"
},
/* available starting with Windows 10 1607 */
{
14393
,
"TCP_FASTOPEN"
}
};
static
void
remove_unusable_flags
(
PyObject
*
m
)
{
PyObject
*
dict
;
OSVERSIONINFOEX
info
;
DWORDLONG
dwlConditionMask
;
dict
=
PyModule_GetDict
(
m
);
if
(
dict
==
NULL
)
{
return
;
}
/* set to Windows 10, except BuildNumber. */
memset
(
&
info
,
0
,
sizeof
(
info
));
info
.
dwOSVersionInfoSize
=
sizeof
(
info
);
info
.
dwMajorVersion
=
10
;
info
.
dwMinorVersion
=
0
;
/* set Condition Mask */
dwlConditionMask
=
0
;
VER_SET_CONDITION
(
dwlConditionMask
,
VER_MAJORVERSION
,
VER_GREATER_EQUAL
);
VER_SET_CONDITION
(
dwlConditionMask
,
VER_MINORVERSION
,
VER_GREATER_EQUAL
);
VER_SET_CONDITION
(
dwlConditionMask
,
VER_BUILDNUMBER
,
VER_GREATER_EQUAL
);
for
(
int
i
=
0
;
i
<
sizeof
(
win_runtime_flags
)
/
sizeof
(
FlagRuntimeInfo
);
i
++
)
{
info
.
dwBuildNumber
=
win_runtime_flags
[
i
].
build_number
;
/* greater than or equal to the specified version?
Compatibility Mode will not cheat VerifyVersionInfo(...) */
if
(
VerifyVersionInfo
(
&
info
,
VER_MAJORVERSION
|
VER_MINORVERSION
|
VER_BUILDNUMBER
,
dwlConditionMask
))
{
break
;
}
else
{
if
(
PyDict_GetItemString
(
dict
,
win_runtime_flags
[
i
].
flag_name
)
!=
NULL
)
{
PyDict_DelItemString
(
dict
,
win_runtime_flags
[
i
].
flag_name
);
}
}
}
}
#endif
#include <stddef.h>
...
...
@@ -7890,5 +7954,11 @@ PyInit__socket(void)
#if defined(USE_GETHOSTBYNAME_LOCK) || defined(USE_GETADDRINFO_LOCK)
netdb_lock
=
PyThread_allocate_lock
();
#endif
#ifdef MS_WINDOWS
/* remove some flags on older version Windows during run-time */
remove_unusable_flags
(
m
);
#endif
return
m
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment