[DEV] add the capabilities to change the disconnection of gateway on the router
This commit is contained in:
parent
8a92ef772b
commit
2c85f1992b
@ -136,6 +136,7 @@ int main(int _argc, const char *_argv[]) {
|
||||
// The default service port is 1985
|
||||
m_client.propertyPort.set(1985);
|
||||
#endif
|
||||
// default delay to disconnect is 30 seconds:
|
||||
uint32_t routerDisconnectionDelay = 30;
|
||||
for (int32_t iii=0; iii<_argc ; ++iii) {
|
||||
std::string data = _argv[iii];
|
||||
@ -148,7 +149,14 @@ int main(int _argc, const char *_argv[]) {
|
||||
} else if (etk::start_with(data, "--router-port=") == true) {
|
||||
basicGateway.propertyRouterPort.set(etk::string_to_uint16_t(std::string(&data[14])));
|
||||
} else if (etk::start_with(data, "--router-delay=") == true) {
|
||||
routerDisconnectionDelay = etk::string_to_uint32_t(std::string(&data[15]));
|
||||
int32_t value = etk::string_to_int32_t(std::string(&data[15]));
|
||||
if (value == -1) {
|
||||
routerDisconnectionDelay = 999999999;
|
||||
} else if (value == 0) {
|
||||
// do nothing
|
||||
} else {
|
||||
routerDisconnectionDelay = value;
|
||||
}
|
||||
} else if (etk::start_with(data, "--service-ip=") == true) {
|
||||
basicGateway.propertyServiceIp.set(std::string(&data[13]));
|
||||
#ifdef GATEWAY_ENABLE_LAUNCHER
|
||||
@ -182,7 +190,7 @@ int main(int _argc, const char *_argv[]) {
|
||||
APPL_PRINT(" --service-ip=XXX Service connection IP (default: " << basicGateway.propertyServiceIp.get() << ")");
|
||||
APPL_PRINT(" --service-port=XXX Service connection PORT (default: " << basicGateway.propertyServicePort.get() << ")");
|
||||
APPL_PRINT(" --service-max=XXX Service Maximum IO (default: " << basicGateway.propertyServiceMax.get() << ")");
|
||||
APPL_PRINT(" --router-delay=XXX Delay before disconnect from the router (default: " << routerDisconnectionDelay << ")");
|
||||
APPL_PRINT(" --router-delay=XXX Delay before disconnect from the router (default: " << routerDisconnectionDelay << "; 0=automatic set by the gateway; -1=never disconnect; other the time)");
|
||||
#ifdef GATEWAY_ENABLE_LAUNCHER
|
||||
APPL_PRINT(" specific for internal launcher:");
|
||||
APPL_PRINT(" --base-path=XXX base path to search data (default: 'USERDATA:')");
|
||||
|
@ -77,6 +77,8 @@ void appl::Windows::init() {
|
||||
m_composer->loadFromFile("DATA:gui.xml");
|
||||
setSubWidget(m_composer);
|
||||
|
||||
drawWidgetTree();
|
||||
|
||||
m_listViewer = ememory::dynamicPointerCast<appl::widget::ListViewer>(m_composer->getSubObjectNamed("ws-name-list-viewer"));
|
||||
m_listViewer->signalSelect.connect(sharedFromThis(), &appl::Windows::onCallbackSelectMedia);
|
||||
|
||||
@ -99,7 +101,6 @@ void appl::Windows::init() {
|
||||
|
||||
subBind(ewol::widget::Button, "access-fast-home", signalPressed, sharedFromThis(), &appl::Windows::onCallbackSelectHome);
|
||||
subBind(ewol::widget::Button, "access-fast-group", signalPressed, sharedFromThis(), &appl::Windows::onCallbackSelectGroup);
|
||||
|
||||
// Direct display list:
|
||||
ewol::propertySetOnObjectNamed("view-selection", "select", "ws-name-list-viewer");
|
||||
subBind(ewol::widget::Menu, "menu-bar", signalSelect, sharedFromThis(), &appl::Windows::onCallbackMenuEvent);
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include <ewol/widget/Image.hpp>
|
||||
#include <ewol/widget/Composer.hpp>
|
||||
#include <ewol/widget/Manager.hpp>
|
||||
//#include <vector>
|
||||
#include <vector>
|
||||
#include <etk/tool.hpp>
|
||||
#include <appl/debug.hpp>
|
||||
@ -30,9 +29,8 @@ appl::widget::Player::Player() {
|
||||
|
||||
void appl::widget::Player::init() {
|
||||
ewol::widget::Composer::init();
|
||||
if (loadFromFile("DATA:gui-player.xml", getId()) == false) {
|
||||
APPL_ERROR("Can not load Player GUI from file ...");
|
||||
return;
|
||||
if (*propertySubFile == "") {
|
||||
propertySubFile.set("DATA:gui-player.xml");
|
||||
}
|
||||
subBind(ewol::widget::Button, "[" + etk::to_string(getId()) + "]appl-player-bt-previous", signalPressed, sharedFromThis(), &appl::widget::Player::onCallbackButtonPrevious);
|
||||
subBind(ewol::widget::Button, "[" + etk::to_string(getId()) + "]appl-player-bt-play", signalValue, sharedFromThis(), &appl::widget::Player::onCallbackButtonPlay);
|
||||
|
@ -139,7 +139,8 @@ appl::Router::Router() :
|
||||
propertyClientMax(this, "client-max", 8000, "Maximum of client at the same time", &appl::Router::onPropertyChangeClientMax),
|
||||
propertyGateWayIp(this, "gw-ip", "127.0.0.1", "Ip to listen Gateway", &appl::Router::onPropertyChangeGateWayIp),
|
||||
propertyGateWayPort(this, "gw-port", 1984, "Port to listen Gateway", &appl::Router::onPropertyChangeGateWayPort),
|
||||
propertyGateWayMax(this, "gw-max", 8000, "Maximum of Gateway at the same time", &appl::Router::onPropertyChangeGateWayMax) {
|
||||
propertyGateWayMax(this, "gw-max", 8000, "Maximum of Gateway at the same time", &appl::Router::onPropertyChangeGateWayMax),
|
||||
propertyDelayToStop(this, "delay-to-stop", 0, "Delay before the client stop the connection in second (default: 0=automatic set by the gateway; -1=never disconnect; other the time )") {
|
||||
m_interfaceClientServer = ememory::makeShared<appl::TcpServerInput>(this, false);
|
||||
m_interfaceGateWayServer = ememory::makeShared<appl::TcpServerInput>(this, true);
|
||||
load_db();
|
||||
@ -218,6 +219,7 @@ ememory::SharedPtr<appl::GateWayInterface> appl::Router::get(const std::string&
|
||||
} else {
|
||||
// We're in the child here.
|
||||
APPL_ERROR("Child Execution ...");
|
||||
// TODO : Correct this ==> this is really bad
|
||||
std::string binary = "/home/heero/dev/perso/out/Linux_x86_64/debug/staging/clang/zeus-package-base/zeus-package-base.app/bin/zeus-gateway";
|
||||
std::string userConf = "--user=" + it.m_name;
|
||||
std::string basePath = "--base-path=" + it.m_basePath;
|
||||
@ -234,12 +236,14 @@ ememory::SharedPtr<appl::GateWayInterface> appl::Router::get(const std::string&
|
||||
//std::string logFile = " ";
|
||||
APPL_INFO("New Child log in = " << logFile);
|
||||
#endif
|
||||
std::string delay = "--router-delay=" + etk::to_string(*propertyDelayToStop);
|
||||
int ret = execlp( binary.c_str(),
|
||||
binary.c_str(), // must repeate the binary name to have the name as first argument ...
|
||||
userConf.c_str(),
|
||||
"--srv=user",
|
||||
"--srv=picture",
|
||||
"--srv=video",
|
||||
delay.c_str(),
|
||||
basePath.c_str(),
|
||||
logFile.c_str(),
|
||||
NULL);
|
||||
|
@ -27,6 +27,7 @@ namespace appl {
|
||||
eproperty::Value<std::string> propertyGateWayIp;
|
||||
eproperty::Value<uint16_t> propertyGateWayPort;
|
||||
eproperty::Value<uint16_t> propertyGateWayMax;
|
||||
eproperty::Value<int32_t> propertyDelayToStop;
|
||||
public:
|
||||
Router();
|
||||
virtual ~Router();
|
||||
|
@ -34,16 +34,19 @@ int main(int _argc, const char *_argv[]) {
|
||||
basicRouter.propertyGateWayPort.set(etk::string_to_uint16_t(std::string(&data[10])));
|
||||
} else if (etk::start_with(data, "--gw-max=") == true) {
|
||||
basicRouter.propertyGateWayMax.set(etk::string_to_uint16_t(std::string(&data[9])));
|
||||
} else if (etk::start_with(data, "--delay-stop-user=") == true) {
|
||||
basicRouter.propertyDelayToStop.set(etk::string_to_int32_t(std::string(&data[18])));
|
||||
} else if ( data == "-h"
|
||||
|| data == "--help") {
|
||||
APPL_PRINT(etk::getApplicationName() << " - help : ");
|
||||
APPL_PRINT(" " << _argv[0] << " [options]");
|
||||
APPL_PRINT(" --client-ip=XXX Client connection IP (default: 1.7.0.0.1)");
|
||||
APPL_PRINT(" --client-port=XXX Client connection PORT (default: 1983)");
|
||||
APPL_PRINT(" --client-max=XXX Client Maximum parallele connection (default: 80)");
|
||||
APPL_PRINT(" --gw-ip=XXX Gateway connection IP (default: 1.7.0.0.1)");
|
||||
APPL_PRINT(" --gw-port=XXX Gateway connection PORT (default: 1984)");
|
||||
APPL_PRINT(" --gw-max=XXX Gateway Maximum IO (default: 15)");
|
||||
APPL_PRINT(" --client-ip=XXX Client connection IP (default: 1.7.0.0.1)");
|
||||
APPL_PRINT(" --client-port=XXX Client connection PORT (default: 1983)");
|
||||
APPL_PRINT(" --client-max=XXX Client Maximum parallele connection (default: 80)");
|
||||
APPL_PRINT(" --gw-ip=XXX Gateway connection IP (default: 1.7.0.0.1)");
|
||||
APPL_PRINT(" --gw-port=XXX Gateway connection PORT (default: 1984)");
|
||||
APPL_PRINT(" --gw-max=XXX Gateway Maximum IO (default: 15)");
|
||||
APPL_PRINT(" --delay-stop-user=XXX Delay before the client stop the connection in second (default: 0=automatic set by the gateway; -1=never disconnect; other the time )");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user