mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Find a random port number to use for the application server to avoid conflicts
with any other apps that may have already bound to the default port used by CP.
This commit is contained in:
@@ -22,8 +22,11 @@
|
||||
// App headers
|
||||
#include "Server.h"
|
||||
|
||||
Server::Server()
|
||||
Server::Server(quint16 port)
|
||||
{
|
||||
// Appserver port
|
||||
m_port = port;
|
||||
|
||||
// Initialise Python
|
||||
Py_SetProgramName(PGA_APP_NAME.toUtf8().data());
|
||||
Py_Initialize();
|
||||
@@ -74,6 +77,9 @@ void Server::run()
|
||||
return;
|
||||
}
|
||||
|
||||
// Set the port number
|
||||
PyRun_SimpleString(QString("PGADMIN_PORT = %1").arg(m_port).toLatin1());
|
||||
|
||||
if (PyRun_SimpleFile(cp, m_appfile.toUtf8().data()) != 0)
|
||||
setError("Failed to launch the application server, server thread exiting.");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user