(self, **kwargs)
| 2849 | thread.start() |
| 2850 | |
| 2851 | def _send(self, **kwargs): |
| 2852 | self._ensure_valid_message(kwargs) |
| 2853 | json_payload = json.dumps(kwargs) |
| 2854 | try: |
| 2855 | self._sockfile.write(json_payload.encode() + b"\n") |
| 2856 | self._sockfile.flush() |
| 2857 | except (OSError, ValueError): |
| 2858 | # We get an OSError if the network connection has dropped, and a |
| 2859 | # ValueError if detach() if the sockfile has been closed. We'll |
| 2860 | # handle this the next time we try to read from the client instead |
| 2861 | # of trying to handle it from everywhere _send() may be called. |
| 2862 | # Track this with a flag rather than assuming readline() will ever |
| 2863 | # return an empty string because the socket may be half-closed. |
| 2864 | self._write_failed = True |
| 2865 | |
| 2866 | @typing.override |
| 2867 | def message(self, msg, end="\n"): |
no test coverage detected