Skip to content

Commit

Permalink
Store udp telemetry ports in endpoint class
Browse files Browse the repository at this point in the history
  • Loading branch information
steveatinfincia committed Mar 18, 2021
1 parent fee2228 commit 35e37f9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions openhd-telemetry/inc/endpoint.h
Expand Up @@ -68,6 +68,7 @@ class Endpoint: public std::enable_shared_from_this<Endpoint> {
std::vector<uint8_t> m_known_sys_ids;

std::string m_address;
uint16_t m_port;

TelemetryType m_telemetry_type = TelemetryTypeUnknown;

Expand Down
4 changes: 2 additions & 2 deletions openhd-telemetry/src/udpendpoint.cpp
Expand Up @@ -40,7 +40,7 @@ void UDPEndpoint::setup(TelemetryType telemetry_type, std::string endpoint_s) {

std::string address = result[2];
std::string port_s = result[3];
uint16_t port = atoi(port_s.c_str());
m_port = atoi(port_s.c_str());

std::stringstream _add;

Expand All @@ -50,7 +50,7 @@ void UDPEndpoint::setup(TelemetryType telemetry_type, std::string endpoint_s) {
// this is used by Router to figure out if a dynamic endpoint has been added already
m_address = _add.str();

m_endpoint = boost::asio::ip::udp::endpoint(boost::asio::ip::address::from_string(address), port);
m_endpoint = boost::asio::ip::udp::endpoint(boost::asio::ip::address::from_string(address), m_port);
m_udp_socket.open(boost::asio::ip::udp::v4());
m_udp_socket.bind(boost::asio::ip::udp::endpoint(boost::asio::ip::address::from_string("0.0.0.0"), local_port));

Expand Down

0 comments on commit 35e37f9

Please sign in to comment.