sshspawner/sshspawner.py
async def poll(self):
        """Poll the spawned process to see if it is still running and reachable

        If the process is still running, and we can connect to the remote
        singleuser server over the tunnel, we return None. If it is not
        running, or unreachable we return the exit code of the process if we
        have access to it, or 0 otherwise.
        """
        status = await super().poll()

        if status is not None:
            if status == 255 and not self._stopping:
                self._stopping = True
                await self.stop()
            return status
        elif not os.path.exists(self.ssh_socket) and not self._started:
            # tunnel is closed or non-existent
            self.clear_state()
            return 0
        else:
            if self.user.settings["internal_ssl"]:
                protocol = "https"
                key = self.user.settings.get("internal_ssl_key")
                cert = self.user.settings.get("internal_ssl_cert")
                ca = self.user.settings.get("internal_ssl_ca")
                ctx = make_ssl_context(key, cert, cafile=ca)
            else:
                protocol = "http"
                ctx = None
            ip = self.ip or "127.0.0.1"
            url = f"{protocol}://{ip}:{self.port}"
            loops_to_do = 10
            loop_timeout = 5
            for loop in range(loops_to_do + 2):
                try:
                    reachable = await wait_for_http_server(url, ssl_context=ctx, timeout=loop_timeout)
                except Exception as e:
                    if isinstance(e, TimeoutError):
                        self.log.debug(f"Server didn't respond on loop: {loop}")
                        if loop > loops_to_do:
                            self.log.warning(
                            f"Unable to reach {self.user.name}'s server for {loop * loop_timeout} seconds. "
                            )
                            return 1
                        else:
                            continue
                    else:
                        e.reason = "error"
                        self.log.warning(f"Error reaching {self.user.name}'s server: {e}")
                        return 2
                else:
                    self.log.debug(f'Server responded on loop: {loop}')
                    return None if reachable else 0
Poll the spawned process to see if it is still running and reachable

        If the process is still running, and we can connect to the remote
        singleuser server over the tunnel, we return None. If it is not
        running, or unreachable we return the exit code of the process if we
        have access to it, or 0 otherwise.
        
Poll the spawned process to see if it is still running and reachable
If the process is still running, and we can connect to the remote
singleuser server over the tunnel, we return None. If it is not
running, or unreachable we return the exit code of the process if we
have access to it, or 0 otherwise.
Poll the spawned process to see if it is still running and reachable If the process is still running and we can connect to the remote singleuser server over the tunnel we return None . If it is not running or unreachable we return the exit code of the process if we have access to it or 0 otherwise .
async def poll(self):
        status = await super().poll()
        if status is not None:
            if status == 255 and not self._stopping:
                self._stopping = True
                await self.stop()
            return status
        elif not os.path.exists(self.ssh_socket) and not self._started:
            self.clear_state()
            return 0
        else:
            if self.user.settings["internal_ssl"]:
                protocol = "https"
                key = self.user.settings.get("internal_ssl_key")
                cert = self.user.settings.get("internal_ssl_cert")
                ca = self.user.settings.get("internal_ssl_ca")
                ctx = make_ssl_context(key, cert, cafile=ca)
            else:
                protocol = "http"
                ctx = None
            ip = self.ip or "127.0.0.1"
            url = f"{protocol}://{ip}:{self.port}"
            loops_to_do = 10
            loop_timeout = 5
            for loop in range(loops_to_do + 2):
                try:
                    reachable = await wait_for_http_server(url, ssl_context=ctx, timeout=loop_timeout)
                except Exception as e:
                    if isinstance(e, TimeoutError):
                        self.log.debug(f"Server didn't respond on loop: {loop}")
                        if loop > loops_to_do:
                            self.log.warning(
                            f"Unable to reach {self.user.name}'s server for {loop * loop_timeout} seconds. "
                            )
                            return 1
                        else:
                            continue
                    else:
                        e.reason = "error"
                        self.log.warning(f"Error reaching {self.user.name}'s server: {e}")
                        return 2
                else:
                    self.log.debug(f'Server responded on loop: {loop}')
                    return None if reachable else 0
async def poll ( self ) : status = await super ( ) . poll ( ) if status is not None : if status == 255 and not self . _stopping : self . _stopping = True await self . stop ( ) return status elif not os . path . exists ( self . ssh_socket ) and not self . _started : self . clear_state ( ) return 0 else : if self . user . settings [ "internal_ssl" ] : protocol = "https" key = self . user . settings . get ( "internal_ssl_key" ) cert = self . user . settings . get ( "internal_ssl_cert" ) ca = self . user . settings . get ( "internal_ssl_ca" ) ctx = make_ssl_context ( key , cert , cafile = ca ) else : protocol = "http" ctx = None ip = self . ip or "127.0.0.1" url = f"{protocol}://{ip}:{self.port}" loops_to_do = 10 loop_timeout = 5 for loop in range ( loops_to_do + 2 ) : try : reachable = await wait_for_http_server ( url , ssl_context = ctx , timeout = loop_timeout ) except Exception as e : if isinstance ( e , TimeoutError ) : self . log . debug ( f"Server didn't respond on loop: {loop}" ) if loop > loops_to_do : self . log . warning ( f"Unable to reach {self.user.name}'s server for {loop * loop_timeout} seconds. " ) return 1 else : continue else : e . reason = "error" self . log . warning ( f"Error reaching {self.user.name}'s server: {e}" ) return 2 else : self . log . debug ( f'Server responded on loop: {loop}' ) return None if reachable else 0
Poll the spawned process to see if it is still running and reachable
If the process is still running, and we can connect to the remote
singleuser server over the tunnel, we return None.
Poll the spawned process to see if it is still running and reachable If the process is still running and we can connect to the remote singleuser server over the tunnel we return None .
"""Poll the spawned process to see if it is still running and reachable

        If the process is still running, and we can connect to the remote
        singleuser server over the tunnel, we return None. If it is not
        running, or unreachable we return the exit code of the process if we
        have access to it, or 0 otherwise.
        """ # tunnel is closed or non-existent
self