(self)
| 40 | return True |
| 41 | |
| 42 | def run(self): |
| 43 | self.dst_sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) |
| 44 | self.dst_sock.connect(('127.0.0.1', self.dst_port)) |
| 45 | sockets = [self.src_sock, self.dst_sock] |
| 46 | while True: |
| 47 | (rlist, wlist, xlist) = select.select(sockets, [], sockets) |
| 48 | if xlist: |
| 49 | self.close() |
| 50 | return |
| 51 | for r in rlist: |
| 52 | if r == self.src_sock: |
| 53 | if not self.forward(self.src_sock, self.dst_sock): |
| 54 | return |
| 55 | elif r == self.dst_sock: |
| 56 | if not self.forward(self.dst_sock, self.src_sock): |
| 57 | return |
| 58 | else: |
| 59 | self.close() |
| 60 | raise RuntimeError("Unknown socket: {}".format(r)) |
| 61 | |
| 62 | def handle_clients(conn_queue): |
| 63 | while True: |
no test coverage detected