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

@ -160,7 +160,7 @@ namespace Mist {
bool inputDTSC::openStreamSource() {
std::string source = config->getString("input");
if (source == "-"){
srcConn = Socket::Connection(fileno(stdout),fileno(stdin));
srcConn.open(fileno(stdout),fileno(stdin));
return true;
}
if (source.find("dtsc://") == 0) {
@ -175,7 +175,7 @@ namespace Mist {
if (streamName == "") {
streamName = givenStream;
}
srcConn = Socket::Connection(host, port, true);
srcConn.open(host, port, true);
if (!srcConn.connected()){
return false;
}

View file

@ -44,9 +44,9 @@ namespace Mist{
int fin = -1, fout = -1;
inputProcess = Util::Procs::StartPiped(args, &fin, &fout, 0);
myConn = Socket::Connection(-1, fout);
myConn.open(-1, fout);
}else{
myConn = Socket::Connection(fileno(stdout), fileno(stdin));
myConn.open(fileno(stdout), fileno(stdin));
}
myConn.Received().splitter.assign("\000\000\001", 3);
myMeta.vod = false;

View file

@ -134,7 +134,7 @@ namespace Mist{
}
bool InputRTSP::openStreamSource(){
tcpCon = Socket::Connection(url.host, url.getPort(), false);
tcpCon.open(url.host, url.getPort(), false);
mainConn = &tcpCon;
return tcpCon;
}

View file

@ -212,13 +212,13 @@ namespace Mist {
int fin = -1, fout = -1;
inputProcess = Util::Procs::StartPiped(args, &fin, &fout, 0);
tcpCon = Socket::Connection(-1, fout);
tcpCon.open(-1, fout);
return true;
}
//streamed file
if (inpt.substr(0,9) == "stream://"){
inFile = fopen(inpt.c_str()+9, "r");
tcpCon = Socket::Connection(-1, fileno(inFile));
tcpCon.open(-1, fileno(inFile));
standAlone = false;
return inFile;
}