From 59d9443ded9d7b39887ffc61d8809e7c6cbe7595 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Mon, 20 Jul 2020 10:55:17 -0500 Subject: [PATCH 1/4] debian: do not allow postinst sysctl failure --- debian/soapysdr-server.postinst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/soapysdr-server.postinst b/debian/soapysdr-server.postinst index 7b86d01..35da788 100644 --- a/debian/soapysdr-server.postinst +++ b/debian/soapysdr-server.postinst @@ -5,7 +5,7 @@ if [ "$1" = "configure" ]; then #Load the new sysctl limits so they are immediately usable. #Otherwise, the limits will be always loaded at boot time. if [ -x "`which sysctl 2>/dev/null`" ]; then - sysctl --load /usr/lib/sysctl.d/SoapySDRServer.conf + sysctl --load /usr/lib/sysctl.d/SoapySDRServer.conf || true fi fi From b76e203f0d84b3b96181d10ae3509bbb7cbfcdb2 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Sat, 9 May 2020 11:32:00 -0500 Subject: [PATCH 2/4] replace selectRecvMultiple return mask with a vector This should support more than 31 sockets --- common/SoapyRPCSocket.cpp | 11 ++++++----- common/SoapyRPCSocket.hpp | 7 ++++--- common/SoapySSDPEndpoint.cpp | 7 ++++--- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/common/SoapyRPCSocket.cpp b/common/SoapyRPCSocket.cpp index 847d4e0..fa63125 100644 --- a/common/SoapyRPCSocket.cpp +++ b/common/SoapyRPCSocket.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2019 Josh Blum +// Copyright (c) 2015-2020 Josh Blum // SPDX-License-Identifier: BSL-1.0 #include "SoapySocketDefs.hpp" @@ -477,7 +477,7 @@ bool SoapyRPCSocket::selectRecv(const long timeoutUs) return ret == 1; } -int SoapyRPCSocket::selectRecvMultiple(const std::vector &socks, const long timeoutUs) +int SoapyRPCSocket::selectRecvMultiple(const std::vector &socks, std::vector &ready, const long timeoutUs) { struct timeval tv; tv.tv_sec = timeoutUs / 1000000; @@ -496,12 +496,13 @@ int SoapyRPCSocket::selectRecvMultiple(const std::vector &sock int ret = ::select(maxSock+1, &readfds, NULL, NULL, &tv); if (ret == -1) return ret; - int mask = 0; + int count = 0; for (size_t i = 0; i < socks.size(); i++) { - if (FD_ISSET(socks[i]->_sock, &readfds)) mask |= (1 << i); + ready[i] = FD_ISSET(socks[i]->_sock, &readfds); + if (ready[i]) count++; } - return mask; + return count; } static std::string errToString(const int err) diff --git a/common/SoapyRPCSocket.hpp b/common/SoapyRPCSocket.hpp index ba43888..b6e8177 100644 --- a/common/SoapyRPCSocket.hpp +++ b/common/SoapyRPCSocket.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2018 Josh Blum +// Copyright (c) 2015-2020 Josh Blum // SPDX-License-Identifier: BSL-1.0 #pragma once @@ -133,9 +133,10 @@ class SOAPY_REMOTE_API SoapyRPCSocket /*! * Wait for recv ready on multiple sockets. - * Return a mask of sockets that are ready or -1 for error + * Set the output ready vector to true for ready or false + * Return a count of sockets that are ready or -1 for error */ - static int selectRecvMultiple(const std::vector &socks, const long timeoutUs); + static int selectRecvMultiple(const std::vector &socks, std::vector &ready, const long timeoutUs); /*! * Query the last error message as a string. diff --git a/common/SoapySSDPEndpoint.cpp b/common/SoapySSDPEndpoint.cpp index 4f48d05..8c860a4 100644 --- a/common/SoapySSDPEndpoint.cpp +++ b/common/SoapySSDPEndpoint.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2018 Josh Blum +// Copyright (c) 2015-2020 Josh Blum // SPDX-License-Identifier: BSL-1.0 /* @@ -252,10 +252,11 @@ void SoapySSDPEndpoint::handlerLoop(void) //vector of sockets for select operation std::vector socks; for (auto &data : _impl->handlers) socks.push_back(&data->sock); + std::vector ready(socks.size()); while (not _impl->done) { - const int socksReady = SoapyRPCSocket::selectRecvMultiple(socks, SOAPY_REMOTE_SOCKET_TIMEOUT_US); + const int socksReady = SoapyRPCSocket::selectRecvMultiple(socks, ready, SOAPY_REMOTE_SOCKET_TIMEOUT_US); if (socksReady == -1 and errno == EINTR) continue; //continue after interrupted system call if (socksReady < 0) { @@ -268,7 +269,7 @@ void SoapySSDPEndpoint::handlerLoop(void) for (size_t i = 0; i < _impl->handlers.size(); i++) { - if ((socksReady & (1 << i)) == 0) continue; + if (not ready[i]) continue; auto data = _impl->handlers[i]; auto &sock = data->sock; From 815d83cc50b5f4ded27dd4efb977275a96ef60aa Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Mon, 20 Jul 2020 15:03:09 -0500 Subject: [PATCH 3/4] updated changelog --- Changelog.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Changelog.txt b/Changelog.txt index 7abdebd..4a70874 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,8 +1,8 @@ Release 0.5.2 (pending) ========================== +- Support more than 31 clients in SSDP endpoint - Handle cases where avahi client is null -- Protect getServerURLs() with mutex - Handle EINTR case for SSDP server select - Fix the scale in CS12 - CF32 conversion - Protect getServerURLs from re-entrant calls From f920d9bf10f62f67c8e31b7dc25090bc784e5210 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Mon, 20 Jul 2020 15:03:41 -0500 Subject: [PATCH 4/4] soapyremote: changelog entry for 0.5.2 --- Changelog.txt | 2 +- debian/changelog | 6 ++++++ debian/copyright | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index 4a70874..7658383 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,4 +1,4 @@ -Release 0.5.2 (pending) +Release 0.5.2 (2020-07-20) ========================== - Support more than 31 clients in SSDP endpoint diff --git a/debian/changelog b/debian/changelog index 4148e8e..49f02f3 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +soapyremote (0.5.2-1) unstable; urgency=low + + * Release 0.5.2 (2020-07-20) + + -- Josh Blum Mon, 20 Jul 2020 15:03:37 -0000 + soapyremote (0.5.1-1) unstable; urgency=low * Release 0.5.1 (2019-01-26) diff --git a/debian/copyright b/debian/copyright index da8cae5..0018d53 100644 --- a/debian/copyright +++ b/debian/copyright @@ -4,7 +4,7 @@ Source: https://github.com/pothosware/SoapyRemote/wiki Files: * Copyright: - Copyright (c) 2015-2019 Josh Blum + Copyright (c) 2015-2020 Josh Blum Copyright (c) 2016-2016 Bastille Networks License: BSL-1.0 Boost Software License - Version 1.0 - August 17th, 2003