File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -50,6 +50,11 @@ namespace network {
5050
5151namespace {
5252
53+ // / Default organization-local multicast address for peer discovery (RFC 2365)
54+ const char * default_announce_address () {
55+ return " 239.226.152.162" ; // NOSONAR
56+ }
57+
5358 iovec make_iovec (void * base, std::size_t len) {
5459#ifdef _WIN32
5560 iovec iov{};
@@ -135,6 +140,9 @@ namespace {
135140
136141 config = new_config;
137142 node_name = new_config.name ;
143+ if (config.announce_address .empty ()) {
144+ config.announce_address = default_announce_address ();
145+ }
138146
139147 // Update module configurations
140148 discovery = std::make_unique<Discovery>(new_config.peer_timeout );
Original file line number Diff line number Diff line change 4141#include " PacketDeduplicator.hpp"
4242#include " Reliability.hpp"
4343#include " Routing.hpp"
44- #include " wire_protocol.hpp"
4544
4645namespace NUClear {
4746namespace network {
@@ -52,8 +51,8 @@ namespace network {
5251 struct NetworkConfig {
5352 // / This node's name on the network
5453 std::string name;
55- // / The multicast/broadcast/unicast address to announce on
56- std::string announce_address = default_announce_address() ;
54+ // / The multicast/broadcast/unicast address to announce on (empty = default organization-local multicast)
55+ std::string announce_address;
5756 // / The port to use for announce discovery
5857 in_port_t announce_port = 7447 ;
5958 // / Address to bind to (empty = all interfaces)
Original file line number Diff line number Diff line change 2424#include " RTTEstimator.hpp"
2525
2626#include < algorithm>
27+ #include < chrono>
2728#include < cmath>
2829
2930namespace NUClear {
Original file line number Diff line number Diff line change 2525#include " Reliability.hpp"
2626
2727#include < algorithm>
28+ #include < chrono>
29+ #include < cstdint>
2830#include < cstring>
31+ #include < mutex>
32+ #include < vector>
2933
3034#include " wire_protocol.hpp"
3135
Original file line number Diff line number Diff line change 2222
2323#include " Routing.hpp"
2424
25+ #include < cstdint>
26+ #include < mutex>
27+ #include < utility>
28+ #include < vector>
29+
2530namespace NUClear {
2631namespace network {
2732
Original file line number Diff line number Diff line change @@ -41,11 +41,6 @@ namespace network {
4141 // / Protocol version for NUClearNet v2
4242 constexpr uint8_t PROTOCOL_VERSION = 0x03 ;
4343
44- // / Default organization-local multicast address for peer discovery (RFC 2365)
45- inline const char * default_announce_address () {
46- return " 239.226.152.162" ; // NOSONAR
47- }
48-
4944 // / Packet type identifiers
5045 enum PacketType : uint8_t {
5146 ANNOUNCE = 1 ,
You can’t perform that action at this time.
0 commit comments