add setPort() method

This commit is contained in:
luddens 2019-10-04 14:06:54 +02:00
parent efe1c2dea3
commit 9975e0b369
2 changed files with 11 additions and 0 deletions

View File

@ -17,6 +17,7 @@ class KiwixServe
void shutDown(); void shutDown();
bool isRunning(); bool isRunning();
int getPort() { return m_port; } int getPort() { return m_port; }
int setPort(int port);
private: private:
std::unique_ptr<Subprocess> mp_kiwixServe; std::unique_ptr<Subprocess> mp_kiwixServe;

View File

@ -68,4 +68,14 @@ bool KiwixServe::isRunning()
return false; return false;
} }
int KiwixServe::setPort(int port)
{
if (port >= 1 && port <= 65535) {
m_port = port;
} else {
return -1;
}
return m_port;
}
} }