Merge branch 'development' into LTS_development
This commit is contained in:
commit
26c9f964be
8 changed files with 44 additions and 9 deletions
|
@ -183,7 +183,15 @@ namespace HTTP{
|
||||||
return true; // Success!
|
return true; // Success!
|
||||||
}
|
}
|
||||||
// reset the data timeout
|
// reset the data timeout
|
||||||
reqTime = Util::bootSecs();
|
if (reqTime != Util::bootSecs()){
|
||||||
|
if (progressCallback != 0){
|
||||||
|
if (!progressCallback()){
|
||||||
|
WARN_MSG("Download aborted by callback");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
reqTime = Util::bootSecs();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (getSocket()){
|
if (getSocket()){
|
||||||
FAIL_MSG("Timeout while retrieving %s (%zu/%" PRIu32 ")", link.getUrl().c_str(),
|
FAIL_MSG("Timeout while retrieving %s (%zu/%" PRIu32 ")", link.getUrl().c_str(),
|
||||||
|
@ -239,7 +247,15 @@ namespace HTTP{
|
||||||
return true; // Success!
|
return true; // Success!
|
||||||
}
|
}
|
||||||
// reset the data timeout
|
// reset the data timeout
|
||||||
reqTime = Util::bootSecs();
|
if (reqTime != Util::bootSecs()){
|
||||||
|
if (progressCallback != 0){
|
||||||
|
if (!progressCallback()){
|
||||||
|
WARN_MSG("Download aborted by callback");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
reqTime = Util::bootSecs();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (getSocket()){
|
if (getSocket()){
|
||||||
FAIL_MSG("Timeout while retrieving %s", link.getUrl().c_str());
|
FAIL_MSG("Timeout while retrieving %s", link.getUrl().c_str());
|
||||||
|
|
|
@ -786,6 +786,13 @@ bool HTTP::Parser::Read(std::string &strbuf){
|
||||||
return parse(strbuf);
|
return parse(strbuf);
|
||||||
}// HTTPReader::Read
|
}// HTTPReader::Read
|
||||||
|
|
||||||
|
/// Checks download completion percentage.
|
||||||
|
/// Returns zero if that doesn't make sense at the time or cannot be determined.
|
||||||
|
uint8_t HTTP::Parser::getPercentage() const{
|
||||||
|
if (!seenHeaders || length < 1){return 0;}
|
||||||
|
return ((body.length() * 100) / length);
|
||||||
|
}
|
||||||
|
|
||||||
/// Attempt to read a whole HTTP response or request from a data buffer.
|
/// Attempt to read a whole HTTP response or request from a data buffer.
|
||||||
/// If succesful, fills its own fields with the proper data and removes the response/request
|
/// If succesful, fills its own fields with the proper data and removes the response/request
|
||||||
/// from the data buffer.
|
/// from the data buffer.
|
||||||
|
|
|
@ -24,6 +24,7 @@ namespace HTTP{
|
||||||
const std::string &GetHeader(const std::string &i) const;
|
const std::string &GetHeader(const std::string &i) const;
|
||||||
bool hasHeader(const std::string &i) const;
|
bool hasHeader(const std::string &i) const;
|
||||||
void clearHeader(const std::string &i);
|
void clearHeader(const std::string &i);
|
||||||
|
uint8_t getPercentage() const;
|
||||||
const std::string &GetVar(const std::string &i) const;
|
const std::string &GetVar(const std::string &i) const;
|
||||||
std::string getUrl();
|
std::string getUrl();
|
||||||
std::string allVars();
|
std::string allVars();
|
||||||
|
|
|
@ -20,7 +20,6 @@ namespace Util {
|
||||||
static bool thread_handler;///< True while thread handler should be running.
|
static bool thread_handler;///< True while thread handler should be running.
|
||||||
static void childsig_handler(int signum);
|
static void childsig_handler(int signum);
|
||||||
static void exit_handler();
|
static void exit_handler();
|
||||||
static void runCmd(std::string & cmd);
|
|
||||||
static char* const* dequeToArgv(std::deque<std::string> & argDeq);
|
static char* const* dequeToArgv(std::deque<std::string> & argDeq);
|
||||||
static void grim_reaper(void * n);
|
static void grim_reaper(void * n);
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -1272,7 +1272,9 @@ Socket::Connection Socket::Server::accept(bool nonblock){
|
||||||
// we could do this through accept4 with a flag, but that call is non-standard...
|
// we could do this through accept4 with a flag, but that call is non-standard...
|
||||||
if (r < 0){
|
if (r < 0){
|
||||||
if ((errno != EWOULDBLOCK) && (errno != EAGAIN) && (errno != EINTR)){
|
if ((errno != EWOULDBLOCK) && (errno != EAGAIN) && (errno != EINTR)){
|
||||||
FAIL_MSG("Error during accept: %s. Closing server socket %d.", strerror(errno), sock);
|
if (errno != EINVAL){
|
||||||
|
FAIL_MSG("Error during accept: %s. Closing server socket %d.", strerror(errno), sock);
|
||||||
|
}
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
return Socket::Connection();
|
return Socket::Connection();
|
||||||
|
|
|
@ -184,17 +184,25 @@ namespace Controller {
|
||||||
if ((*it).substr(0, 7) == "MistOut"){
|
if ((*it).substr(0, 7) == "MistOut"){
|
||||||
arg_one = Util::getMyPath() + (*it);
|
arg_one = Util::getMyPath() + (*it);
|
||||||
conn_args[0] = arg_one.c_str();
|
conn_args[0] = arg_one.c_str();
|
||||||
capabilities["connectors"][(*it).substr(7)] = JSON::fromString(Util::Procs::getOutputOf((char**)conn_args));
|
std::string entryName = (*it).substr(7);
|
||||||
if (capabilities["connectors"][(*it).substr(7)].size() < 1){
|
capabilities["connectors"][entryName] = JSON::fromString(Util::Procs::getOutputOf((char**)conn_args));
|
||||||
capabilities["connectors"].removeMember((*it).substr(7));
|
if (capabilities["connectors"][entryName].size() < 1){
|
||||||
|
capabilities["connectors"].removeMember(entryName);
|
||||||
|
}else if (capabilities["connectors"][entryName]["version"].asStringRef() != PACKAGE_VERSION){
|
||||||
|
WARN_MSG("Output %s version mismatch (%s != " PACKAGE_VERSION ")", entryName.c_str(), capabilities["connectors"][entryName]["version"].asStringRef().c_str());
|
||||||
|
capabilities["connectors"].removeMember(entryName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((*it).substr(0, 6) == "MistIn" && (*it) != "MistInfo"){
|
if ((*it).substr(0, 6) == "MistIn" && (*it) != "MistInfo"){
|
||||||
arg_one = Util::getMyPath() + (*it);
|
arg_one = Util::getMyPath() + (*it);
|
||||||
conn_args[0] = arg_one.c_str();
|
conn_args[0] = arg_one.c_str();
|
||||||
capabilities["inputs"][(*it).substr(6)] = JSON::fromString(Util::Procs::getOutputOf((char**)conn_args));
|
std::string entryName = (*it).substr(6);
|
||||||
if (capabilities["inputs"][(*it).substr(6)].size() < 1){
|
capabilities["inputs"][entryName] = JSON::fromString(Util::Procs::getOutputOf((char**)conn_args));
|
||||||
|
if (capabilities["inputs"][entryName].size() < 1){
|
||||||
capabilities["inputs"].removeMember((*it).substr(6));
|
capabilities["inputs"].removeMember((*it).substr(6));
|
||||||
|
}else if (capabilities["inputs"][entryName]["version"].asStringRef() != PACKAGE_VERSION){
|
||||||
|
WARN_MSG("Input %s version mismatch (%s != " PACKAGE_VERSION ")", entryName.c_str(), capabilities["inputs"][entryName]["version"].asStringRef().c_str());
|
||||||
|
capabilities["inputs"].removeMember(entryName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -220,6 +220,7 @@ namespace Mist {
|
||||||
Util::Config::streamName = streamName;
|
Util::Config::streamName = streamName;
|
||||||
|
|
||||||
if (config->getBool("json")) {
|
if (config->getBool("json")) {
|
||||||
|
capa["version"] = PACKAGE_VERSION;
|
||||||
std::cout << capa.toString() << std::endl;
|
std::cout << capa.toString() << std::endl;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@ int main(int argc, char * argv[]) {
|
||||||
mistOut::init(&conf);
|
mistOut::init(&conf);
|
||||||
if (conf.parseArgs(argc, argv)) {
|
if (conf.parseArgs(argc, argv)) {
|
||||||
if (conf.getBool("json")) {
|
if (conf.getBool("json")) {
|
||||||
|
mistOut::capa["version"] = PACKAGE_VERSION;
|
||||||
std::cout << mistOut::capa.toString() << std::endl;
|
std::cout << mistOut::capa.toString() << std::endl;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue