From a9a2443f377690dc4f977492b12dd789d6d68d97 Mon Sep 17 00:00:00 2001 From: Tom Early Date: Tue, 7 Jul 2020 19:56:12 -0700 Subject: [PATCH] binding for transcoder fix --- src/cdplusprotocol.cpp | 2 +- src/ctranscoder.cpp | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/cdplusprotocol.cpp b/src/cdplusprotocol.cpp index 7cafc3c..0fa95b9 100644 --- a/src/cdplusprotocol.cpp +++ b/src/cdplusprotocol.cpp @@ -37,7 +37,7 @@ bool CDplusProtocol::Init(void) { // base class - if (Initialize("REF", DPLUS_PORT)) + if (! Initialize("REF", DPLUS_PORT)) return false; // update time diff --git a/src/ctranscoder.cpp b/src/ctranscoder.cpp index 17a915e..92b092a 100644 --- a/src/ctranscoder.cpp +++ b/src/ctranscoder.cpp @@ -69,7 +69,7 @@ CTranscoder::~CTranscoder() bool CTranscoder::Init(void) { - // create server's IP + // create port to the transcoder auto s = g_Reflector.GetTranscoderIp(); m_Ip.Initialize(strchr(s, ':') ? AF_INET6 : AF_INET, TRANSCODER_PORT, s); @@ -80,10 +80,14 @@ bool CTranscoder::Init(void) return true; } + // now open the transcoder port + s = (AF_INET == m_Ip.GetFamily()) ? g_Reflector.GetListenIPv4() : g_Reflector.GetListenIPv6(); + CIp tc(m_Ip.GetFamily(), TRANSCODER_PORT, s); + // create our socket - if (m_Ip.IsSet()) + if (tc.IsSet()) { - if (! m_Socket.Open(m_Ip)) { + if (! m_Socket.Open(tc)) { std::cerr << "Error opening socket on port UDP" << TRANSCODER_PORT << " on ip " << m_Ip << std::endl; return false; } @@ -91,7 +95,7 @@ bool CTranscoder::Init(void) else { // something bad was specified for the transcoder IP? - std::cerr << "Could not initialize transcoder socket on '" << s << "'" << std::endl; + std::cerr << "Error initializing transcoder port using " << ((AF_INET == m_Ip.GetFamily()) ? "IPv4" : "IPv6") << " on " << s << std::endl; return false; }