Added a proxy in Output for getting the host (by Erik Zandvliet)
This commit is contained in:
parent
2d78e1e5f1
commit
d56e7f1408
7 changed files with 21 additions and 7 deletions
|
@ -606,7 +606,7 @@ bool Socket::Connection::iwrite(std::string & buffer) {
|
||||||
} //iwrite
|
} //iwrite
|
||||||
|
|
||||||
/// Gets hostname for connection, if available.
|
/// Gets hostname for connection, if available.
|
||||||
std::string Socket::Connection::getHost() {
|
std::string Socket::Connection::getHost() const {
|
||||||
return remotehost;
|
return remotehost;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ namespace Socket {
|
||||||
void drop(); ///< Close connection without shutdown.
|
void drop(); ///< Close connection without shutdown.
|
||||||
void setBlocking(bool blocking); ///< Set this socket to be blocking (true) or nonblocking (false).
|
void setBlocking(bool blocking); ///< Set this socket to be blocking (true) or nonblocking (false).
|
||||||
bool isBlocking(); ///< Check if this socket is blocking (true) or nonblocking (false).
|
bool isBlocking(); ///< Check if this socket is blocking (true) or nonblocking (false).
|
||||||
std::string getHost(); ///< Gets hostname for connection, if available.
|
std::string getHost() const; ///< Gets hostname for connection, if available.
|
||||||
std::string getBinHost();
|
std::string getBinHost();
|
||||||
void setHost(std::string host); ///< Sets hostname for connection manually.
|
void setHost(std::string host); ///< Sets hostname for connection manually.
|
||||||
int getSocket(); ///< Returns internal socket number.
|
int getSocket(); ///< Returns internal socket number.
|
||||||
|
|
|
@ -112,6 +112,14 @@ namespace Mist {
|
||||||
sought = false;
|
sought = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string Output::getConnectedHost(){
|
||||||
|
return myConn.getHost();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string Output::getConnectedBinHost(){
|
||||||
|
return myConn.getBinHost();
|
||||||
|
}
|
||||||
|
|
||||||
/// Connects or reconnects to the stream.
|
/// Connects or reconnects to the stream.
|
||||||
/// Assumes streamName class member has been set already.
|
/// Assumes streamName class member has been set already.
|
||||||
/// Will start input if not currently active, calls onFail() if this does not succeed.
|
/// Will start input if not currently active, calls onFail() if this does not succeed.
|
||||||
|
@ -665,7 +673,7 @@ namespace Mist {
|
||||||
IPC::statExchange tmpEx(statsPage.getData());
|
IPC::statExchange tmpEx(statsPage.getData());
|
||||||
tmpEx.now(now);
|
tmpEx.now(now);
|
||||||
if (setHost){
|
if (setHost){
|
||||||
tmpEx.host(myConn.getBinHost());
|
tmpEx.host(getConnectedBinHost());
|
||||||
setHost = false;
|
setHost = false;
|
||||||
}
|
}
|
||||||
tmpEx.crc(crc);
|
tmpEx.crc(crc);
|
||||||
|
|
|
@ -75,6 +75,11 @@ namespace Mist {
|
||||||
bool sought;///<If a seek has been done, this is set to true. Used for seeking on prepareNext().
|
bool sought;///<If a seek has been done, this is set to true. Used for seeking on prepareNext().
|
||||||
bool completeKeyReadyTimeOut;//a bool to see if there has been a keyframe TimeOut for complete keys in Live
|
bool completeKeyReadyTimeOut;//a bool to see if there has been a keyframe TimeOut for complete keys in Live
|
||||||
protected://these are to be messed with by child classes
|
protected://these are to be messed with by child classes
|
||||||
|
|
||||||
|
virtual std::string getConnectedHost();
|
||||||
|
virtual std::string getConnectedBinHost();
|
||||||
|
|
||||||
|
|
||||||
IPC::sharedClient statsPage;///< Shared memory used for statistics reporting.
|
IPC::sharedClient statsPage;///< Shared memory used for statistics reporting.
|
||||||
bool isBlocking;///< If true, indicates that myConn is blocking.
|
bool isBlocking;///< If true, indicates that myConn is blocking.
|
||||||
unsigned int crc;///< Checksum, if any, for usage in the stats.
|
unsigned int crc;///< Checksum, if any, for usage in the stats.
|
||||||
|
|
|
@ -307,7 +307,7 @@ namespace Mist {
|
||||||
DEBUG_MSG(DLVL_HIGH, "Connector found: %s", connector.c_str());
|
DEBUG_MSG(DLVL_HIGH, "Connector found: %s", connector.c_str());
|
||||||
//build arguments for starting output process
|
//build arguments for starting output process
|
||||||
|
|
||||||
std::string temphost=myConn.getHost();
|
std::string temphost=getConnectedHost();
|
||||||
std::string debuglevel = JSON::Value((long long)Util::Config::printDebugLevel).asString();
|
std::string debuglevel = JSON::Value((long long)Util::Config::printDebugLevel).asString();
|
||||||
std::string tmparg = Util::getMyPath() + std::string("MistOut") + connector;
|
std::string tmparg = Util::getMyPath() + std::string("MistOut") + connector;
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
namespace Mist {
|
namespace Mist {
|
||||||
OutHTTP::OutHTTP(Socket::Connection & conn) : HTTPOutput(conn){
|
OutHTTP::OutHTTP(Socket::Connection & conn) : HTTPOutput(conn){
|
||||||
if (myConn.getPureSocket() >= 0){
|
if (myConn.getPureSocket() >= 0){
|
||||||
std::string host = myConn.getHost();
|
std::string host = getConnectedHost();
|
||||||
dup2(myConn.getSocket(), STDIN_FILENO);
|
dup2(myConn.getSocket(), STDIN_FILENO);
|
||||||
dup2(myConn.getSocket(), STDOUT_FILENO);
|
dup2(myConn.getSocket(), STDOUT_FILENO);
|
||||||
myConn.drop();
|
myConn.drop();
|
||||||
|
@ -15,6 +15,7 @@ namespace Mist {
|
||||||
myConn.setHost(host);
|
myConn.setHost(host);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
OutHTTP::~OutHTTP() {}
|
OutHTTP::~OutHTTP() {}
|
||||||
|
|
||||||
bool OutHTTP::listenMode(){
|
bool OutHTTP::listenMode(){
|
||||||
|
|
|
@ -499,13 +499,13 @@ namespace Mist {
|
||||||
std::string IP = source.substr(0, source.find('@'));
|
std::string IP = source.substr(0, source.find('@'));
|
||||||
if (IP != ""){
|
if (IP != ""){
|
||||||
if (!myConn.isAddress(IP)){
|
if (!myConn.isAddress(IP)){
|
||||||
DEBUG_MSG(DLVL_FAIL, "Push from %s to %s rejected - source host not whitelisted", myConn.getHost().c_str(), streamName.c_str());
|
DEBUG_MSG(DLVL_FAIL, "Push from %s to %s rejected - source host not whitelisted", getConnectedHost().c_str(), streamName.c_str());
|
||||||
myConn.close();
|
myConn.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
DEBUG_MSG(DLVL_FAIL, "Push from %s rejected - stream '%s' not configured.", myConn.getHost().c_str(), streamName.c_str());
|
DEBUG_MSG(DLVL_FAIL, "Push from %s rejected - stream '%s' not configured.", getConnectedHost().c_str(), streamName.c_str());
|
||||||
myConn.close();
|
myConn.close();
|
||||||
}
|
}
|
||||||
configLock.post();
|
configLock.post();
|
||||||
|
|
Loading…
Add table
Reference in a new issue