(self, **kwargs)
| 3136 | ) |
| 3137 | |
| 3138 | def _send(self, **kwargs): |
| 3139 | self._ensure_valid_message(kwargs) |
| 3140 | json_payload = json.dumps(kwargs) |
| 3141 | try: |
| 3142 | self.server_socket.sendall(json_payload.encode() + b"\n") |
| 3143 | except OSError: |
| 3144 | # This means that the client has abruptly disconnected, but we'll |
| 3145 | # handle that the next time we try to read from the client instead |
| 3146 | # of trying to handle it from everywhere _send() may be called. |
| 3147 | # Track this with a flag rather than assuming readline() will ever |
| 3148 | # return an empty string because the socket may be half-closed. |
| 3149 | self.write_failed = True |
| 3150 | |
| 3151 | def _readline(self): |
| 3152 | if self.sigint_received: |
no test coverage detected