From cba77610436e50cfde78646845dbb670695b3f7a Mon Sep 17 00:00:00 2001 From: Alex Biddulph Date: Mon, 8 Jan 2024 14:55:57 +1100 Subject: [PATCH 1/5] Add missing include --- src/nuclear/src/extension/network/NUClearNetwork.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/nuclear/src/extension/network/NUClearNetwork.cpp b/src/nuclear/src/extension/network/NUClearNetwork.cpp index 179a7f1..70729cb 100644 --- a/src/nuclear/src/extension/network/NUClearNetwork.cpp +++ b/src/nuclear/src/extension/network/NUClearNetwork.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #include "../../util/network/get_interfaces.hpp" From 153d3cf3ac8c8e2130f59e62e30e7506e339619f Mon Sep 17 00:00:00 2001 From: Alex Biddulph Date: Mon, 8 Jan 2024 14:56:13 +1100 Subject: [PATCH 2/5] Add missing return statement --- src/nuclear/src/extension/network/NUClearNetwork.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/nuclear/src/extension/network/NUClearNetwork.cpp b/src/nuclear/src/extension/network/NUClearNetwork.cpp index 70729cb..18c8985 100644 --- a/src/nuclear/src/extension/network/NUClearNetwork.cpp +++ b/src/nuclear/src/extension/network/NUClearNetwork.cpp @@ -38,6 +38,7 @@ namespace extension { case AF_INET6: return sizeof(sockaddr_in6); default: throw std::runtime_error("unhandled socket address family"); } + return {}; } NUClearNetwork::PacketQueue::PacketTarget::PacketTarget(std::weak_ptr target, From 11dba067f4635d33fd1cf52caddcdab91a2abf3c Mon Sep 17 00:00:00 2001 From: Alex Biddulph Date: Mon, 8 Jan 2024 15:09:03 +1100 Subject: [PATCH 3/5] Update node version --- .github/workflows/node.js.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 068a61b..fb8ee85 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -18,7 +18,7 @@ jobs: matrix: os: [ubuntu-latest, windows-latest, macos-latest] # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ - node-version: [12.x, 14.x, 16.x] + node-version: [18.x, 20.x] steps: - uses: actions/checkout@v2 From 73556c8949fe94eac4eddb81aefc186e55c68ec5 Mon Sep 17 00:00:00 2001 From: Alex Biddulph Date: Mon, 8 Jan 2024 15:09:29 +1100 Subject: [PATCH 4/5] Explicitly install node-gyp --- .github/workflows/node.js.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index fb8ee85..9614f60 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -21,6 +21,9 @@ jobs: node-version: [18.x, 20.x] steps: + # Install node-gyp + - name: Install node-gyp + run: npm install -g node-gyp - uses: actions/checkout@v2 - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v2 From 9e04554882b4dfca0b4f7e61b36fb192d7de7639 Mon Sep 17 00:00:00 2001 From: Alex Biddulph Date: Mon, 8 Jan 2024 16:04:23 +1100 Subject: [PATCH 5/5] Revert: Add missing return statement --- .../src/extension/network/NUClearNetwork.cpp | 21 +++++-------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/src/nuclear/src/extension/network/NUClearNetwork.cpp b/src/nuclear/src/extension/network/NUClearNetwork.cpp index 18c8985..e7cf8c7 100644 --- a/src/nuclear/src/extension/network/NUClearNetwork.cpp +++ b/src/nuclear/src/extension/network/NUClearNetwork.cpp @@ -38,7 +38,6 @@ namespace extension { case AF_INET6: return sizeof(sockaddr_in6); default: throw std::runtime_error("unhandled socket address family"); } - return {}; } NUClearNetwork::PacketQueue::PacketTarget::PacketTarget(std::weak_ptr target, @@ -173,9 +172,7 @@ namespace extension { // Swap our address so the rest of the information is anys if (address.sock.sa_family == AF_INET) { address.ipv4.sin_addr.s_addr = htonl(INADDR_ANY); } - else if (address.sock.sa_family == AF_INET6) { - address.ipv6.sin6_addr = IN6ADDR_ANY_INIT; - } + else if (address.sock.sa_family == AF_INET6) { address.ipv6.sin6_addr = IN6ADDR_ANY_INIT; } // Make our socket announce_fd = ::socket(address.sock.sa_family, SOCK_DGRAM, IPPROTO_UDP); @@ -234,9 +231,7 @@ namespace extension { sizeof(ip_mreq)); if (status < 0) { last_network_errno = network_errno; } - else { - connected_count++; - } + else { connected_count++; } } } @@ -554,15 +549,11 @@ namespace extension { ++it; } // Remove them from the list - else { - it = qit->second.targets.erase(it); - } + else { it = qit->second.targets.erase(it); } } if (qit->second.targets.empty()) { qit = send_queue.erase(qit); } - else { - ++qit; - } + else { ++qit; } } } @@ -649,9 +640,7 @@ namespace extension { } } // They're old but at least they're not timing out - else { - remote->last_update = std::chrono::steady_clock::now(); - } + else { remote->last_update = std::chrono::steady_clock::now(); } } break; case LEAVE: {