File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ def __init__(self, socket_source: Protocol) -> None:
31
31
in CircuitPython or the `socket` module in CPython.
32
32
"""
33
33
self ._buffer = bytearray (1024 )
34
- self ._timeout = 0
34
+ self ._timeout = 1
35
35
self .route_handlers = {}
36
36
self ._socket_source = socket_source
37
37
self ._sock = None
@@ -107,7 +107,7 @@ def poll(self):
107
107
# Receiving data until timeout
108
108
while "Receiving data" :
109
109
try :
110
- length = conn .recv_into (self ._buffer )
110
+ length = conn .recv_into (self ._buffer , len ( self . _buffer ) )
111
111
received_data += self ._buffer [:length ]
112
112
except OSError as ex :
113
113
if ex .errno == ETIMEDOUT :
@@ -192,9 +192,9 @@ def socket_timeout(self) -> int:
192
192
193
193
@socket_timeout .setter
194
194
def socket_timeout (self , value : int ) -> None :
195
- if isinstance (value , (int , float )) and value >= 0 :
195
+ if isinstance (value , (int , float )) and value > 0 :
196
196
self ._timeout = value
197
197
else :
198
- raise TypeError (
199
- "HTTPServer.socket_timeout must be a non-negative numeric value."
198
+ raise ValueError (
199
+ "HTTPServer.socket_timeout must be a positive numeric value."
200
200
)
You can’t perform that action at this time.
0 commit comments