Alter the way that the P25 Network is opened for IPv4 and IPv6.

This commit is contained in:
Jonathan Naylor 2020-11-05 09:51:05 +00:00
parent 14da695e8e
commit 99b3c15b33
2 changed files with 10 additions and 5 deletions

View File

@ -43,11 +43,16 @@ bool CP25Network::open()
{ {
LogInfo("Opening P25 network connection"); LogInfo("Opening P25 network connection");
bool ret = m_socket.open(0, PF_INET, "", m_port); unsigned int index = 0U;
if (!ret)
return false;
return m_socket.open(1, PF_INET6, "", m_port); bool ret1 = m_socket.open(index, PF_INET, "", m_port);
if (ret1)
index++;
bool ret2 = m_socket.open(index, PF_INET6, "", m_port);
// We're OK as long as we have either IPv4 or IPv6 or both.
return ret1 || ret2;
} }
bool CP25Network::write(const unsigned char* data, unsigned int length, const sockaddr_storage& addr, unsigned int addrLen) bool CP25Network::write(const unsigned char* data, unsigned int length, const sockaddr_storage& addr, unsigned int addrLen)

View File

@ -19,6 +19,6 @@
#if !defined(VERSION_H) #if !defined(VERSION_H)
#define VERSION_H #define VERSION_H
const char* VERSION = "20201104"; const char* VERSION = "20201105";
#endif #endif