Merge pull request #223 from amnezia-vpn/bugfix/tcp-port-busy-check

in the port busy check, for tcp only the local port is now checked
This commit is contained in:
pokamest 2023-04-18 18:26:59 +01:00 committed by GitHub
commit 97e322ba22
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -662,6 +662,14 @@ ErrorCode ServerController::isServerPortBusy(const ServerCredentials &credential
}
if (!stdOut.isEmpty()) {
if (transportProto == "tcp") {
const static QRegularExpression localPortRegExp(".*:(\\d+)->");
QRegularExpressionMatch localPortMatch = localPortRegExp.match(stdOut);
if (localPortMatch.hasMatch() && localPortMatch.captured(1) != port) {
return ErrorCode::NoError;
}
}
return ErrorCode::ServerPortAlreadyAllocatedError;
}
return ErrorCode::NoError;