in the port busy check, for tcp now only LISTEN ports are checked
This commit is contained in:
parent
fc603f11ce
commit
7216a8b923
1 changed files with 5 additions and 8 deletions
|
|
@ -655,6 +655,11 @@ ErrorCode ServerController::isServerPortBusy(const ServerCredentials &credential
|
||||||
script = script.append("|:%1").arg(port);
|
script = script.append("|:%1").arg(port);
|
||||||
}
|
}
|
||||||
script = script.append("' | grep -i %1").arg(transportProto);
|
script = script.append("' | grep -i %1").arg(transportProto);
|
||||||
|
|
||||||
|
if (transportProto == "tcp") {
|
||||||
|
script = script.append(" | grep LISTEN");
|
||||||
|
}
|
||||||
|
|
||||||
ErrorCode errorCode = runScript(credentials,
|
ErrorCode errorCode = runScript(credentials,
|
||||||
replaceVars(script, genVarsForScript(credentials, container)), cbReadStdOut, cbReadStdErr);
|
replaceVars(script, genVarsForScript(credentials, container)), cbReadStdOut, cbReadStdErr);
|
||||||
if (errorCode != ErrorCode::NoError) {
|
if (errorCode != ErrorCode::NoError) {
|
||||||
|
|
@ -662,14 +667,6 @@ ErrorCode ServerController::isServerPortBusy(const ServerCredentials &credential
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!stdOut.isEmpty()) {
|
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::ServerPortAlreadyAllocatedError;
|
||||||
}
|
}
|
||||||
return ErrorCode::NoError;
|
return ErrorCode::NoError;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue