mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -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;
|
QTcpSocket socket;
|
||||||
|
|
||||||
// Bind the socket on the specified port. It it fails then
|
// Bind the socket on the specified port.
|
||||||
// port is in use.
|
socket.bind(port, QTcpSocket::DontShareAddress);
|
||||||
bool bindSuccessful = socket.bind(port, QTcpSocket::ShareAddress);
|
|
||||||
|
|
||||||
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)
|
void Runtime::openConfigureWindow(const QString errorMsg)
|
||||||
|
Loading…
Reference in New Issue
Block a user