mirror of https://github.com/ShaYmez/xlxd.git
Avoid using public IP for transcoder connection
This commit is contained in:
parent
af900106c5
commit
220da86aa0
|
@ -99,7 +99,7 @@ bool CCodecStream::Init(uint16 uiPort)
|
|||
m_uiPort = uiPort;
|
||||
|
||||
// create our socket
|
||||
ok = m_Socket.Open(uiPort);
|
||||
ok = m_Socket.Open(CIp("0.0.0.0"), uiPort);
|
||||
if ( ok )
|
||||
{
|
||||
// start thread;
|
||||
|
|
|
@ -97,7 +97,7 @@ bool CTranscoder::Init(void)
|
|||
m_Ip = g_Reflector.GetTranscoderIp();
|
||||
|
||||
// create our socket
|
||||
ok = m_Socket.Open(TRANSCODER_PORT);
|
||||
ok = m_Socket.Open(CIp("0.0.0.0"), TRANSCODER_PORT);
|
||||
if ( ok )
|
||||
{
|
||||
// start thread;
|
||||
|
|
|
@ -51,6 +51,11 @@ CUdpSocket::~CUdpSocket()
|
|||
// open & close
|
||||
|
||||
bool CUdpSocket::Open(uint16 uiPort)
|
||||
{
|
||||
return Open(g_Reflector.GetListenIp(), uiPort);
|
||||
}
|
||||
|
||||
bool CUdpSocket::Open(const CIp & listenIp, uint16 uiPort)
|
||||
{
|
||||
bool open = false;
|
||||
|
||||
|
@ -62,7 +67,7 @@ bool CUdpSocket::Open(uint16 uiPort)
|
|||
::memset(&m_SocketAddr, 0, sizeof(struct sockaddr_in));
|
||||
m_SocketAddr.sin_family = AF_INET;
|
||||
m_SocketAddr.sin_port = htons(uiPort);
|
||||
m_SocketAddr.sin_addr.s_addr = inet_addr(g_Reflector.GetListenIp());
|
||||
m_SocketAddr.sin_addr.s_addr = inet_addr(listenIp);
|
||||
|
||||
if ( bind(m_Socket, (struct sockaddr *)&m_SocketAddr, sizeof(struct sockaddr_in)) == 0 )
|
||||
{
|
||||
|
|
|
@ -56,6 +56,7 @@ public:
|
|||
|
||||
// open & close
|
||||
bool Open(uint16);
|
||||
bool Open(const CIp &, uint16);
|
||||
void Close(void);
|
||||
int GetSocket(void) { return m_Socket; }
|
||||
|
||||
|
|
Loading…
Reference in New Issue