File tree Expand file tree Collapse file tree 1 file changed +0
-29
lines changed Expand file tree Collapse file tree 1 file changed +0
-29
lines changed Original file line number Diff line number Diff line change @@ -313,35 +313,6 @@ def __enter__(self):
313313 def __exit__ (self , exception_type , exception_value , traceback ):
314314 self .deinit ()
315315
316- def _sock_exact_recv (self , bufsize ):
317- """Reads _exact_ number of bytes from the connected socket. Will only return
318- string with the exact number of bytes requested.
319-
320- The semantics of native socket receive is that it returns no more than the
321- specified number of bytes (i.e. max size). However, it makes no guarantees in
322- terms of the minimum size of the buffer, which could be 1 byte. This is a
323- wrapper for socket recv() to ensure that no less than the expected number of
324- bytes is returned or trigger a timeout exception.
325-
326- :param int bufsize: number of bytes to receive
327- """
328- stamp = time .monotonic ()
329- rc = self ._sock .recv (bufsize )
330- to_read = bufsize - len (rc )
331- assert to_read >= 0
332- read_timeout = self .keep_alive
333- while to_read > 0 :
334- recv = self ._sock .recv (to_read )
335- to_read -= len (recv )
336- rc += recv
337- if time .monotonic () - stamp > read_timeout :
338- raise MMQTTException (
339- "Unable to receive {} bytes within {} seconds." .format (
340- to_read , read_timeout
341- )
342- )
343- return rc
344-
345316 def deinit (self ):
346317 """De-initializes the MQTT client and disconnects from the mqtt broker."""
347318 self .disconnect ()
You can’t perform that action at this time.
0 commit comments