Implemented push setting storage.
This commit is contained in:
parent
4a3c2a055b
commit
b9f6107528
3 changed files with 29 additions and 0 deletions
|
@ -616,6 +616,10 @@ int Controller::handleAPIConnection(Socket::Connection & conn){
|
||||||
Response["push_auto_list"] = Controller::Storage["autopushes"];
|
Response["push_auto_list"] = Controller::Storage["autopushes"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Request.isMember("push_settings")){
|
||||||
|
Controller::pushSettings(Request["push_settings"], Response["push_settings"]);
|
||||||
|
}
|
||||||
|
|
||||||
Controller::configChanged = true;
|
Controller::configChanged = true;
|
||||||
|
|
||||||
}else{//unauthorized
|
}else{//unauthorized
|
||||||
|
|
|
@ -12,6 +12,9 @@ namespace Controller {
|
||||||
/// Internal list of currently active pushes
|
/// Internal list of currently active pushes
|
||||||
std::map<pid_t, JSON::Value> activePushes;
|
std::map<pid_t, JSON::Value> activePushes;
|
||||||
|
|
||||||
|
/// Internal list of waiting pushes
|
||||||
|
std::deque<JSON::Value> waitingPushes;
|
||||||
|
|
||||||
/// Immediately starts a push for the given stream to the given target.
|
/// Immediately starts a push for the given stream to the given target.
|
||||||
/// Simply calls Util::startPush and stores the resulting PID in the local activePushes map.
|
/// Simply calls Util::startPush and stores the resulting PID in the local activePushes map.
|
||||||
void startPush(std::string & stream, std::string & target){
|
void startPush(std::string & stream, std::string & target){
|
||||||
|
@ -30,6 +33,10 @@ namespace Controller {
|
||||||
Util::Procs::Stop(ID);
|
Util::Procs::Stop(ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Loops, checking every second if any pushes need restarting.
|
||||||
|
void pushCheckLoop(){
|
||||||
|
}
|
||||||
|
|
||||||
/// Gives a list of all currently active pushes
|
/// Gives a list of all currently active pushes
|
||||||
void listPush(JSON::Value & output){
|
void listPush(JSON::Value & output){
|
||||||
output.null();
|
output.null();
|
||||||
|
@ -116,5 +123,18 @@ namespace Controller {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void pushSettings(const JSON::Value & request, JSON::Value & response){
|
||||||
|
if (request.isObject()){
|
||||||
|
if (request.isMember("wait")){
|
||||||
|
Controller::Storage["push_settings"]["wait"] = request["wait"].asInt();
|
||||||
|
}
|
||||||
|
if (request.isMember("maxspeed")){
|
||||||
|
Controller::Storage["push_settings"]["maxspeed"] = request["maxspeed"].asInt();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
response = Controller::Storage["push_settings"];
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,11 @@ namespace Controller {
|
||||||
void removePush(const JSON::Value & request);
|
void removePush(const JSON::Value & request);
|
||||||
void removePush(const std::string & streamname);
|
void removePush(const std::string & streamname);
|
||||||
|
|
||||||
|
//internal use only
|
||||||
void doAutoPush(std::string & streamname);
|
void doAutoPush(std::string & streamname);
|
||||||
|
void pushCheckLoop();
|
||||||
|
|
||||||
|
//for storing/retrieving settings
|
||||||
|
void pushSettings(const JSON::Value & request, JSON::Value & response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue