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
15899209
Kaydet (Commit)
15899209
authored
Şub 19, 2014
tarafından
Yury Selivanov
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
asyncio: WriteTransport.set_write_buffer_size to call _maybe_pause_protocol
üst
a6919aa4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
2 deletions
+29
-2
transports.py
Lib/asyncio/transports.py
+6
-2
test_transports.py
Lib/test/test_asyncio/test_transports.py
+23
-0
No files found.
Lib/asyncio/transports.py
Dosyayı görüntüle @
15899209
...
...
@@ -241,7 +241,7 @@ class _FlowControlMixin(Transport):
def
__init__
(
self
,
extra
=
None
):
super
()
.
__init__
(
extra
)
self
.
_protocol_paused
=
False
self
.
set_write_buffer_limits
()
self
.
_
set_write_buffer_limits
()
def
_maybe_pause_protocol
(
self
):
size
=
self
.
get_write_buffer_size
()
...
...
@@ -273,7 +273,7 @@ class _FlowControlMixin(Transport):
'protocol'
:
self
.
_protocol
,
})
def
set_write_buffer_limits
(
self
,
high
=
None
,
low
=
None
):
def
_
set_write_buffer_limits
(
self
,
high
=
None
,
low
=
None
):
if
high
is
None
:
if
low
is
None
:
high
=
64
*
1024
...
...
@@ -287,5 +287,9 @@ class _FlowControlMixin(Transport):
self
.
_high_water
=
high
self
.
_low_water
=
low
def
set_write_buffer_limits
(
self
,
high
=
None
,
low
=
None
):
self
.
_set_write_buffer_limits
(
high
=
high
,
low
=
low
)
self
.
_maybe_pause_protocol
()
def
get_write_buffer_size
(
self
):
raise
NotImplementedError
Lib/test/test_asyncio/test_transports.py
Dosyayı görüntüle @
15899209
...
...
@@ -4,6 +4,7 @@ import unittest
import
unittest.mock
import
asyncio
from
asyncio
import
transports
class
TransportTests
(
unittest
.
TestCase
):
...
...
@@ -60,6 +61,28 @@ class TransportTests(unittest.TestCase):
self
.
assertRaises
(
NotImplementedError
,
transport
.
terminate
)
self
.
assertRaises
(
NotImplementedError
,
transport
.
kill
)
def
test_flowcontrol_mixin_set_write_limits
(
self
):
class
MyTransport
(
transports
.
_FlowControlMixin
,
transports
.
Transport
):
def
get_write_buffer_size
(
self
):
return
512
transport
=
MyTransport
()
transport
.
_protocol
=
unittest
.
mock
.
Mock
()
self
.
assertFalse
(
transport
.
_protocol_paused
)
with
self
.
assertRaisesRegex
(
ValueError
,
'high.*must be >= low'
):
transport
.
set_write_buffer_limits
(
high
=
0
,
low
=
1
)
transport
.
set_write_buffer_limits
(
high
=
1024
,
low
=
128
)
self
.
assertFalse
(
transport
.
_protocol_paused
)
transport
.
set_write_buffer_limits
(
high
=
256
,
low
=
128
)
self
.
assertTrue
(
transport
.
_protocol_paused
)
if
__name__
==
'__main__'
:
unittest
.
main
()
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