Fix push outputs to use the correct remote addresses

This commit is contained in:
Thulinma 2022-10-10 14:16:48 +02:00
parent 7098f8430b
commit 0674443066
7 changed files with 9 additions and 5 deletions

View file

@ -1207,7 +1207,7 @@ std::string Socket::Connection::getBinHost(){
}
/// Sets hostname for connection manually.
/// Overwrites the detected host, thus possibily making it incorrect.
/// Overwrites the detected host, thus possibly making it incorrect.
void Socket::Connection::setHost(std::string host){
remotehost = host;
struct addrinfo *result, hints;

View file

@ -208,6 +208,7 @@ namespace Socket{
if (outgoing_port){setupAdapter("", outgoing_port);}
sockaddr_in sa = createInetAddr(_host, _port);
memcpy(&remoteaddr, &sa, sizeof(sockaddr_in));
sockaddr *psa = (sockaddr *)&sa;
HIGH_MSG("Going to connect sock %d", sock);

View file

@ -218,10 +218,9 @@ namespace Mist{
std::string Output::getConnectedBinHost(){
if (!prevHost.size()){
if (myConn && myConn.getPureSocket() != -1){
prevHost = myConn.getBinHost();
}
if (!prevHost.size()){prevHost.assign("\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\001", 16);}
MEDIUM_MSG("Setting prevHost to %s", getConnectedHost().c_str());
prevHost = myConn.getBinHost();
if (!prevHost.size()){prevHost.assign("\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", 16);}
}
return prevHost;
}

View file

@ -93,6 +93,7 @@ namespace Mist{
INFO_MSG("About to push stream %s out. Host: %s, port: %" PRIu32 ", location: %s",
streamName.c_str(), pushUrl.host.c_str(), pushUrl.getPort(), pushUrl.path.c_str());
myConn.setHost(pushUrl.host);
initialize();
initialSeek();
startPushOut();

View file

@ -54,6 +54,7 @@ namespace Mist{
}
INFO_MSG("About to push stream %s out. Host: %s, port: %d, app: %s, stream: %s", streamName.c_str(),
pushUrl.host.c_str(), pushUrl.getPort(), app.c_str(), streamOut.c_str());
myConn.setHost(pushUrl.host);
initialize();
initialSeek();
startPushOut("");

View file

@ -85,6 +85,7 @@ namespace Mist{
}
}
pushSock.SetDestination(target.host, target.getPort());
myConn.setHost(target.host);
pushing = false;
}else{
//No push target? Check if this is a push input or pull output by waiting for data for 5s

View file

@ -130,6 +130,7 @@ namespace Mist{
onFail("Failed to start RIST connection");
return;
}
myConn.setHost(target.host);
wantRequest = false;
parseData = true;
initialize();