@@ -2,8 +2,8 @@ cdef class UVBaseTransport(UVSocketHandle):
22
33 def __cinit__ (self ):
44 # 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
77
88 self ._protocol = None
99 self ._protocol_connected = 0
@@ -59,25 +59,6 @@ cdef class UVBaseTransport(UVSocketHandle):
5959 ' protocol' : self ._protocol,
6060 })
6161
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-
8162 cdef inline _maybe_pause_protocol(self ):
8263 cdef:
8364 size_t size = self ._get_write_buffer_size()
@@ -283,12 +264,10 @@ cdef class UVBaseTransport(UVSocketHandle):
283264 def set_write_buffer_limits (self , high = None , low = None ):
284265 self ._ensure_alive()
285266
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)
290269
291- self ._set_write_buffer_limits(high, low )
270+ self ._maybe_pause_protocol( )
292271
293272 def get_write_buffer_limits (self ):
294273 return (self ._low_water, self ._high_water)
0 commit comments