mirror of
https://github.com/progval/irctest.git
synced 2025-04-07 15:59:49 +00:00
Merge pull request #6 from DanielOaks/auto-server-start-wait
Automatically wait for server to start when connecting
This commit is contained in:
@ -2,7 +2,9 @@ import os
|
||||
import shutil
|
||||
import socket
|
||||
import tempfile
|
||||
import time
|
||||
import subprocess
|
||||
import psutil
|
||||
|
||||
from .optional_extensions import NotImplementedByController
|
||||
|
||||
@ -60,4 +62,11 @@ class BaseServerController(_BaseController):
|
||||
raise NotImplementedError()
|
||||
def registerUser(self, case, username):
|
||||
raise NotImplementedByController('registration')
|
||||
def wait_for_port(self, proc, port):
|
||||
port_open = False
|
||||
while not port_open:
|
||||
time.sleep(0.1)
|
||||
for conn in psutil.Process(proc.pid).connections():
|
||||
if conn.laddr[1] == port:
|
||||
port_open = True
|
||||
|
||||
|
Reference in New Issue
Block a user