| 782 | mux.send(0, ssnet.CMD_HOST_REQ, str.encode('\n'.join(seed_hosts))) |
| 783 | |
| 784 | def check_ssh_alive(): |
| 785 | if daemon: |
| 786 | # poll() won't tell us when process exited since the |
| 787 | # process is no longer our child (it returns 0 all the |
| 788 | # time). |
| 789 | try: |
| 790 | os.kill(serverproc.pid, 0) |
| 791 | except OSError: |
| 792 | raise Fatal('ssh connection to server (pid %d) exited.' % |
| 793 | serverproc.pid) |
| 794 | else: |
| 795 | rv = serverproc.poll() |
| 796 | # poll returns None if process hasn't exited. |
| 797 | if rv is not None: |
| 798 | raise Fatal('ssh connection to server (pid %d) exited ' |
| 799 | 'with returncode %d' % (serverproc.pid, rv)) |
| 800 | |
| 801 | while 1: |
| 802 | check_ssh_alive() |