|
29 | 29 |
|
30 | 30 |
|
31 | 31 | class BaseModbusClient(ModbusClientMixin): |
32 | | - """ Inteface for a modbus synchronous client. Defined here are all the |
| 32 | + """ Interface for a modbus synchronous client. Defined here are all the |
33 | 33 | methods for performing the related request methods. Derived classes |
34 | 34 | simply need to implement the transport methods and set the correct |
35 | 35 | framer. |
@@ -259,7 +259,7 @@ def _recv(self, size): |
259 | 259 | # socket.recv(size) waits until it gets some data from the host but |
260 | 260 | # not necessarily the entire response that can be fragmented in |
261 | 261 | # many packets. |
262 | | - # To avoid the splitted responses to be recognized as invalid |
| 262 | + # To avoid split responses to be recognized as invalid |
263 | 263 | # messages and to be discarded, loops socket.recv until full data |
264 | 264 | # is received or timeout is expired. |
265 | 265 | # If timeout expires returns the read data, also if its length is |
@@ -408,7 +408,7 @@ def _recv(self, size): |
408 | 408 | # socket.recv(size) waits until it gets some data from the host but |
409 | 409 | # not necessarily the entire response that can be fragmented in |
410 | 410 | # many packets. |
411 | | - # To avoid the splitted responses to be recognized as invalid |
| 411 | + # To avoid split responses to be recognized as invalid |
412 | 412 | # messages and to be discarded, loops socket.recv until full data |
413 | 413 | # is received or timeout is expired. |
414 | 414 | # If timeout expires returns the read data, also if its length is |
@@ -709,12 +709,12 @@ def _wait_for_data(self): |
709 | 709 | condition = partial(lambda dummy1, dummy2: True, dummy2=None) |
710 | 710 | start = time.time() |
711 | 711 | while condition(start): |
712 | | - avaialble = self._in_waiting() |
713 | | - if (more_data and not avaialble) or (more_data and avaialble == size): |
| 712 | + available = self._in_waiting() |
| 713 | + if (more_data and not available) or (more_data and available == size): |
714 | 714 | break |
715 | | - if avaialble and avaialble != size: |
| 715 | + if available and available != size: |
716 | 716 | more_data = True |
717 | | - size = avaialble |
| 717 | + size = available |
718 | 718 | time.sleep(0.01) |
719 | 719 | return size |
720 | 720 |
|
|
0 commit comments