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
7165754b
Unverified
Kaydet (Commit)
7165754b
authored
May 28, 2018
tarafından
Yury Selivanov
Kaydeden (comit)
GitHub
May 28, 2018
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
bpo-32410: Avoid blocking on file IO in sendfile fallback code (GH-7172)
üst
416c1ebd
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
24 additions
and
2 deletions
+24
-2
base_events.py
Lib/asyncio/base_events.py
+5
-2
constants.py
Lib/asyncio/constants.py
+4
-0
test_base_events.py
Lib/test/test_asyncio/test_base_events.py
+3
-0
test_events.py
Lib/test/test_asyncio/test_events.py
+11
-0
2018-05-28-16-19-35.bpo-32410.Z1DZaF.rst
...S.d/next/Library/2018-05-28-16-19-35.bpo-32410.Z1DZaF.rst
+1
-0
No files found.
Lib/asyncio/base_events.py
Dosyayı görüntüle @
7165754b
...
...
@@ -800,7 +800,10 @@ class BaseEventLoop(events.AbstractEventLoop):
async
def
_sock_sendfile_fallback
(
self
,
sock
,
file
,
offset
,
count
):
if
offset
:
file
.
seek
(
offset
)
blocksize
=
min
(
count
,
16384
)
if
count
else
16384
blocksize
=
(
min
(
count
,
constants
.
SENDFILE_FALLBACK_READBUFFER_SIZE
)
if
count
else
constants
.
SENDFILE_FALLBACK_READBUFFER_SIZE
)
buf
=
bytearray
(
blocksize
)
total_sent
=
0
try
:
...
...
@@ -810,7 +813,7 @@ class BaseEventLoop(events.AbstractEventLoop):
if
blocksize
<=
0
:
break
view
=
memoryview
(
buf
)[:
blocksize
]
read
=
file
.
readinto
(
view
)
read
=
await
self
.
run_in_executor
(
None
,
file
.
readinto
,
view
)
if
not
read
:
break
# EOF
await
self
.
sock_sendall
(
sock
,
view
)
...
...
Lib/asyncio/constants.py
Dosyayı görüntüle @
7165754b
...
...
@@ -14,6 +14,10 @@ DEBUG_STACK_DEPTH = 10
# Number of seconds to wait for SSL handshake to complete
SSL_HANDSHAKE_TIMEOUT
=
10.0
# Used in sendfile fallback code. We use fallback for platforms
# that don't support sendfile, or for TLS connections.
SENDFILE_FALLBACK_READBUFFER_SIZE
=
1024
*
256
# The enum should be here to break circular dependencies between
# base_events and sslproto
class
_SendfileMode
(
enum
.
Enum
):
...
...
Lib/test/test_asyncio/test_base_events.py
Dosyayı görüntüle @
7165754b
...
...
@@ -1818,12 +1818,15 @@ class BaseLoopSockSendfileTests(test_utils.TestCase):
@classmethod
def
setUpClass
(
cls
):
cls
.
__old_bufsize
=
constants
.
SENDFILE_FALLBACK_READBUFFER_SIZE
constants
.
SENDFILE_FALLBACK_READBUFFER_SIZE
=
1024
*
16
with
open
(
support
.
TESTFN
,
'wb'
)
as
fp
:
fp
.
write
(
cls
.
DATA
)
super
()
.
setUpClass
()
@classmethod
def
tearDownClass
(
cls
):
constants
.
SENDFILE_FALLBACK_READBUFFER_SIZE
=
cls
.
__old_bufsize
support
.
unlink
(
support
.
TESTFN
)
super
()
.
tearDownClass
()
...
...
Lib/test/test_asyncio/test_events.py
Dosyayı görüntüle @
7165754b
...
...
@@ -2160,6 +2160,17 @@ class SockSendfileMixin(SendfileBase):
async
def
wait_closed
(
self
):
await
self
.
fut
@classmethod
def
setUpClass
(
cls
):
cls
.
__old_bufsize
=
constants
.
SENDFILE_FALLBACK_READBUFFER_SIZE
constants
.
SENDFILE_FALLBACK_READBUFFER_SIZE
=
1024
*
16
super
()
.
setUpClass
()
@classmethod
def
tearDownClass
(
cls
):
constants
.
SENDFILE_FALLBACK_READBUFFER_SIZE
=
cls
.
__old_bufsize
super
()
.
tearDownClass
()
def
set_socket_opts
(
self
,
sock
):
# On macOS, SO_SNDBUF is reset by connect(). So this method
# should be called after the socket is connected.
...
...
Misc/NEWS.d/next/Library/2018-05-28-16-19-35.bpo-32410.Z1DZaF.rst
0 → 100644
Dosyayı görüntüle @
7165754b
Avoid blocking on file IO in sendfile fallback code
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