fix(network): use correct protocol for systemd socket

Update AsyncAcceptor to assign the socket using the endpoint's protocol
instead of hardcoded IPv4. This ensures compatibility with both IPv4 and
IPv6 endpoints when using systemd socket activation.
This commit is contained in:
Ovv 2025-11-04 17:56:47 +01:00
parent bc755bf275
commit 2fe3b8ea61
2 changed files with 3 additions and 3 deletions

View File

@ -15,8 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _SYSTEMD_H_
#define _SYSTEMD_H_
#ifndef _SYSTEMD_H_
#define _SYSTEMD_H_
int get_listen_fd();

View File

@ -44,7 +44,7 @@ public:
{
LOG_DEBUG("network", "Using socket from systemd socket activation");
boost::system::error_code errorCode;
_acceptor.assign(boost::asio::ip::tcp::v4(), listen_fd, errorCode);
_acceptor.assign(_endpoint.protocol(), listen_fd, errorCode);
if (errorCode)
LOG_WARN("network", "Failed to assign socket {}", errorCode.message());
}