mirror of https://github.com/kiwix/libkiwix.git
add setPort() method
This commit is contained in:
parent
efe1c2dea3
commit
9975e0b369
|
@ -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;
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue