(self, data)
| 58 | self._process_data(data) |
| 59 | |
| 60 | def _process_data(self, data): |
| 61 | buf = ua.utils.Buffer(data) |
| 62 | while True: |
| 63 | try: |
| 64 | backup_buf = buf.copy() |
| 65 | try: |
| 66 | hdr = uabin.header_from_binary(buf) |
| 67 | except ua.utils.NotEnoughData: |
| 68 | logger.info("We did not receive enough data from client, waiting for more") |
| 69 | self.data = backup_buf.read(len(backup_buf)) |
| 70 | return |
| 71 | if len(buf) < hdr.body_size: |
| 72 | logger.info("We did not receive enough data from client, waiting for more") |
| 73 | self.data = backup_buf.read(len(backup_buf)) |
| 74 | return |
| 75 | ret = self.processor.process(hdr, buf) |
| 76 | if not ret: |
| 77 | logger.info("processor returned False, we close connection from %s", self.peername) |
| 78 | self.transport.close() |
| 79 | return |
| 80 | if len(buf) == 0: |
| 81 | return |
| 82 | except Exception: |
| 83 | logger.exception("Exception raised while parsing message from client, closing") |
| 84 | return |
| 85 | |
| 86 | |
| 87 | class BinaryServer(object): |
no test coverage detected