print('''Starting OmniDB websocket...''') logger.info('''Starting OmniDB websocket...''') print('''Checking port availability...''') logger.info('''Checking port availability...''') while not check_port(port) or num_attempts_port >= 20: print("Port {0} is busy, trying another port...".format(port)) logger.info("Port {0} is busy, trying another port...".format(port)) port = random.randint(1025, 32676) num_attempts_port = num_attempts_port + 1 if num_attempts_port < 20: OmniDB.settings.OMNIDB_WEBSOCKET_PORT = port OmniDB.settings.OMNIDB_EXTERNAL_WEBSOCKET_PORT = port OmniDB.settings.OMNIDB_ADDRESS = '127.0.0.1' print("Starting websocket server at port {0}.".format(str(port))) logger.info("Starting websocket server at port {0}.".format(str(port))) #Removing Expired Sessions SessionStore.clear_expired() #Websocket Core ws_core.start_wsserver_thread() DjangoApplication().run() else: print('Tried 20 different ports without success, closing...') logger.info('Tried 20 different ports without success, closing...')
OmniDB.settings.OMNIDB_EXTERNAL_WEBSOCKET_PORT = ews_port OmniDB.settings.OMNIDB_ADDRESS = listening_address OmniDB.settings.IS_SSL = is_ssl OmniDB.settings.SSL_CERTIFICATE = ssl_certificate_file OmniDB.settings.SSL_KEY = ssl_key_file OmniDB.settings.SESSION_COOKIE_SECURE = True OmniDB.settings.CSRF_COOKIE_SECURE = True print ("Starting websocket server at port {0}.".format(str(port)),flush=True) logger.info("Starting websocket server at port {0}.".format(str(port))) #Removing Expired Sessions SessionStore.clear_expired() #Websocket Core ws_core.start_wsserver_thread() DjangoApplication().run( { 'listening_address' : listening_address, 'listening_port' : listening_port, 'is_ssl' : is_ssl, 'ssl_certificate_file': ssl_certificate_file, 'ssl_key_file' : ssl_key_file } ) else: print('Tried 20 different ports without success, closing...',flush=True) logger.info('Tried 20 different ports without success, closing...')