Robustified Socket::Connection, added debugging data for copies/assigns and Socket::Connetion::open() calls for proper socket re-use.

This commit is contained in:
Thulinma 2019-06-30 22:36:29 +02:00
parent 8fe1dbb618
commit 66890c4564
16 changed files with 141 additions and 44 deletions

View file

@ -323,7 +323,7 @@ dashAnalyser::dashAnalyser(Util::Config conf) : analysers(conf) {
startTime = Util::bootSecs();
abortTime = conf.getInteger("abort");
conn = Socket::Connection(server, port, false);
conn.open(server, port, false);
if(!conn.connected())
{
@ -336,7 +336,7 @@ dashAnalyser::dashAnalyser(Util::Config conf) : analysers(conf) {
urlPrependStuff = url.substr(0, url.rfind("/") + 1);
DEBUG_MSG(DLVL_INFO, "prepend stuff: %s", urlPrependStuff.c_str());
if (!conn) {
conn = Socket::Connection(server, port, false);
conn.open(server, port, false);
}
pos = 0;
@ -414,7 +414,7 @@ int dashAnalyser::doAnalyse() {
for (unsigned int i = 0; i < streamData.size(); i++) {
if (streamData[i].trackID == currentPos.begin()->trackID && streamData[i].adaptationSet == currentPos.begin()->adaptationSet) tempID = i;
}
if (!conn) { conn = Socket::Connection(server, port, false); }
if (!conn) { conn.open(server, port, false); }
HTTP::Parser H;
H.url = urlPrependStuff;
H.url.append(currentPos.begin()->url);
@ -530,7 +530,7 @@ int main2(int argc, char **argv) {
DEBUG_MSG(DLVL_INFO, "url %s server: %s port: %d", url.c_str(), server.c_str(), port);
std::string urlPrependStuff = url.substr(0, url.rfind("/") + 1);
DEBUG_MSG(DLVL_INFO, "prepend stuff: %s", urlPrependStuff.c_str());
if (!conn) { conn = Socket::Connection(server, port, false); }
if (!conn) { conn.open(server, port, false); }
unsigned int pos = 0;
HTTP::Parser H;
H.url = url;
@ -593,7 +593,7 @@ int main2(int argc, char **argv) {
for (unsigned int i = 0; i < streamData.size(); i++) {
if (streamData[i].trackID == currentPos.begin()->trackID && streamData[i].adaptationSet == currentPos.begin()->adaptationSet) tempID = i;
}
if (!conn) { conn = Socket::Connection(server, port, false); }
if (!conn) { conn.open(server, port, false); }
HTTP::Parser H;
H.url = urlPrependStuff;
H.url.append(currentPos.begin()->url);

View file

@ -14,7 +14,7 @@ void AnalyserDTSC::init(Util::Config &conf){
bool AnalyserDTSC::open(const std::string &filename){
if (!Analyser::open(filename)){return false;}
conn = Socket::Connection(1, 0);
conn.open(1, 0);
totalBytes = 0;
return true;
}

View file

@ -27,7 +27,7 @@ void AnalyserRTSP::incoming(const DTSC::Packet &pkt){
bool AnalyserRTSP::open(const std::string &filename){
if (!Analyser::open(filename)){return false;}
myConn = Socket::Connection(1, 0);
myConn.open(1, 0);
return true;
}

View file

@ -369,7 +369,7 @@ int main(int argc, char ** argv) {
std::string urlPrependStuff= url.substr(0, url.rfind("/")+1);
DEBUG_MSG(DLVL_INFO, "prepend stuff: %s", urlPrependStuff.c_str());
if (!conn) {
conn = Socket::Connection(server, port, false);
conn.open(server, port, false);
}
unsigned int pos = 0;
HTTP::Parser H;
@ -434,7 +434,7 @@ int main(int argc, char ** argv) {
if( streamData[i].trackID == currentPos.begin()->trackID && streamData[i].adaptationSet == currentPos.begin()->adaptationSet ) tempID=i;
}
if (!conn) {
conn = Socket::Connection(server,port, false);
conn.open(server,port, false);
}
HTTP::Parser H;
H.url = urlPrependStuff;