@@ -2,8 +2,8 @@ cdef class UVBaseTransport(UVSocketHandle):
2
2
3
3
def __cinit__ (self ):
4
4
# Flow control
5
- self ._high_water = FLOW_CONTROL_HIGH_WATER
6
- self ._low_water = FLOW_CONTROL_LOW_WATER
5
+ self ._high_water = FLOW_CONTROL_HIGH_WATER * 1024
6
+ self ._low_water = FLOW_CONTROL_HIGH_WATER // 4
7
7
8
8
self ._protocol = None
9
9
self ._protocol_connected = 0
@@ -59,25 +59,6 @@ cdef class UVBaseTransport(UVSocketHandle):
59
59
' protocol' : self ._protocol,
60
60
})
61
61
62
- cdef inline _set_write_buffer_limits(self , int high = - 1 , int low = - 1 ):
63
- if high == - 1 :
64
- if low == - 1 :
65
- high = FLOW_CONTROL_HIGH_WATER
66
- else :
67
- high = FLOW_CONTROL_LOW_WATER
68
-
69
- if low == - 1 :
70
- low = high // 4
71
-
72
- if not high >= low >= 0 :
73
- raise ValueError (' high (%r ) must be >= low (%r ) must be >= 0' %
74
- (high, low))
75
-
76
- self ._high_water = high
77
- self ._low_water = low
78
-
79
- self ._maybe_pause_protocol()
80
-
81
62
cdef inline _maybe_pause_protocol(self ):
82
63
cdef:
83
64
size_t size = self ._get_write_buffer_size()
@@ -283,12 +264,10 @@ cdef class UVBaseTransport(UVSocketHandle):
283
264
def set_write_buffer_limits (self , high = None , low = None ):
284
265
self ._ensure_alive()
285
266
286
- if high is None :
287
- high = - 1
288
- if low is None :
289
- low = - 1
267
+ self ._high_water, self ._low_water = add_water_defaults(
268
+ high, low, FLOW_CONTROL_HIGH_WATER)
290
269
291
- self ._set_write_buffer_limits(high, low )
270
+ self ._maybe_pause_protocol( )
292
271
293
272
def get_write_buffer_limits (self ):
294
273
return (self ._low_water, self ._high_water)
0 commit comments