mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2024-11-22 08:46:39 -06:00
Modified the logic to check Port is in use for runtime. Fixes #5751.
This commit is contained in:
parent
eaa90ee8eb
commit
9ae9ccff16
@ -346,11 +346,15 @@ bool Runtime::isPortInUse(const quint16 port) const
|
||||
{
|
||||
QTcpSocket socket;
|
||||
|
||||
// Bind the socket on the specified port. It it fails then
|
||||
// port is in use.
|
||||
bool bindSuccessful = socket.bind(port, QTcpSocket::ShareAddress);
|
||||
// Bind the socket on the specified port.
|
||||
socket.bind(port, QTcpSocket::DontShareAddress);
|
||||
|
||||
return !bindSuccessful;
|
||||
// Returns the host port number of the local socket if available; otherwise returns 0
|
||||
quint16 tmpPort = socket.localPort();
|
||||
if (tmpPort == 0)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void Runtime::openConfigureWindow(const QString errorMsg)
|
||||
|
Loading…
Reference in New Issue
Block a user