(self, command)
| 69 | Client.run = patched_run |
| 70 | |
| 71 | def send_rcon_command(self, command): |
| 72 | try: |
| 73 | with Client( |
| 74 | host=self.host, |
| 75 | port=self.port, |
| 76 | passwd=self.passwd, |
| 77 | timeout=1) as client: |
| 78 | response = client.run(command) |
| 79 | return True, response |
| 80 | |
| 81 | except TimeoutError: |
| 82 | return False, "连接超时,请检查服务端" |
| 83 | except ConnectionResetError: |
| 84 | return False, "远程主机强迫关闭了一个现有的连接,请重连RCON" |
| 85 | except: |
| 86 | return False, "未知错误" |
| 87 | |
| 88 | def check_rcon(self): |
| 89 | while True: |
no outgoing calls
no test coverage detected