Merge branch 'dev' of github.com:amnezia-vpn/amnezia-client into feature/new-gui
This commit is contained in:
commit
e3e2c0ab6a
2 changed files with 7 additions and 7 deletions
|
@ -664,7 +664,8 @@ ErrorCode ServerController::isServerPortBusy(const ServerCredentials &credential
|
||||||
ProtocolProps::transportProtoToString(ProtocolProps::defaultTransportProto(protocol), protocol);
|
ProtocolProps::transportProtoToString(ProtocolProps::defaultTransportProto(protocol), protocol);
|
||||||
QString transportProto = containerConfig.value(config_key::transport_proto).toString(defaultTransportProto);
|
QString transportProto = containerConfig.value(config_key::transport_proto).toString(defaultTransportProto);
|
||||||
|
|
||||||
QString script = QString("which lsof &>/dev/null || true && sudo lsof -i -P -n | grep -E ':%1 ").arg(port);
|
// TODO reimplement with netstat
|
||||||
|
QString script = QString("which lsof &>/dev/null || true && sudo lsof -i -P -n 2>/dev/null | grep -E ':%1 ").arg(port);
|
||||||
for (auto &port : fixedPorts) {
|
for (auto &port : fixedPorts) {
|
||||||
script = script.append("|:%1").arg(port);
|
script = script.append("|:%1").arg(port);
|
||||||
}
|
}
|
||||||
|
@ -728,7 +729,7 @@ ErrorCode ServerController::isServerDpkgBusy(const ServerCredentials &credential
|
||||||
|
|
||||||
QFuture<ErrorCode> future = QtConcurrent::run([this, &stdOut, &cbReadStdOut, &cbReadStdErr, &credentials]() {
|
QFuture<ErrorCode> future = QtConcurrent::run([this, &stdOut, &cbReadStdOut, &cbReadStdErr, &credentials]() {
|
||||||
// max 100 attempts
|
// max 100 attempts
|
||||||
for (int i = 0; i < 100; ++i) {
|
for (int i = 0; i < 30; ++i) {
|
||||||
if (m_cancelInstallation) {
|
if (m_cancelInstallation) {
|
||||||
return ErrorCode::ServerCancelInstallation;
|
return ErrorCode::ServerCancelInstallation;
|
||||||
}
|
}
|
||||||
|
@ -738,9 +739,8 @@ ErrorCode ServerController::isServerDpkgBusy(const ServerCredentials &credential
|
||||||
genVarsForScript(credentials)),
|
genVarsForScript(credentials)),
|
||||||
cbReadStdOut, cbReadStdErr);
|
cbReadStdOut, cbReadStdErr);
|
||||||
|
|
||||||
// if 'fuser' is not installed, skip check
|
if (stdOut.contains("Packet manager not found")) return ErrorCode::ServerPacketManagerError;
|
||||||
if (stdOut.contains("Not installed"))
|
if (stdOut.contains("fuser not installed")) return ErrorCode::NoError;
|
||||||
return ErrorCode::NoError;
|
|
||||||
|
|
||||||
if (stdOut.isEmpty()) {
|
if (stdOut.isEmpty()) {
|
||||||
return ErrorCode::NoError;
|
return ErrorCode::NoError;
|
||||||
|
@ -749,7 +749,7 @@ ErrorCode ServerController::isServerDpkgBusy(const ServerCredentials &credential
|
||||||
qDebug().noquote() << stdOut;
|
qDebug().noquote() << stdOut;
|
||||||
#endif
|
#endif
|
||||||
emit serverIsBusy(true);
|
emit serverIsBusy(true);
|
||||||
QThread::msleep(5000);
|
QThread::msleep(10000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ErrorCode::ServerPacketManagerError;
|
return ErrorCode::ServerPacketManagerError;
|
||||||
|
|
|
@ -2,4 +2,4 @@ if which apt-get > /dev/null 2>&1; then LOCK_FILE="/var/lib/dpkg/lock-frontend";
|
||||||
elif which dnf > /dev/null 2>&1; then LOCK_FILE="/var/run/dnf.pid";\
|
elif which dnf > /dev/null 2>&1; then LOCK_FILE="/var/run/dnf.pid";\
|
||||||
elif which yum > /dev/null 2>&1; then LOCK_FILE="/var/run/yum.pid";\
|
elif which yum > /dev/null 2>&1; then LOCK_FILE="/var/run/yum.pid";\
|
||||||
else echo "Packet manager not found"; echo "Internal error"; exit 1; fi;\
|
else echo "Packet manager not found"; echo "Internal error"; exit 1; fi;\
|
||||||
if command -v fuser > /dev/null 2>&1; then sudo fuser $LOCK_FILE; else echo "Not installed"; fi
|
if command -v fuser > /dev/null 2>&1; then sudo fuser $LOCK_FILE 2>/dev/null; else echo "fuser not installed"; fi
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue