mirror of
https://github.com/transmission/transmission.git
synced 2025-12-20 02:18:42 +00:00
fix: don't bind udp sockets if no OS support (#7552)
This commit is contained in:
@@ -166,7 +166,11 @@ tr_session::tr_udp_core::tr_udp_core(tr_session& session, tr_port udp_port)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (auto sock = socket(PF_INET, SOCK_DGRAM, 0); sock != TR_BAD_SOCKET)
|
if (!session.has_ip_protocol(TR_AF_INET))
|
||||||
|
{
|
||||||
|
// no IPv4; do nothing
|
||||||
|
}
|
||||||
|
else if (auto sock = socket(PF_INET, SOCK_DGRAM, 0); sock != TR_BAD_SOCKET)
|
||||||
{
|
{
|
||||||
(void)evutil_make_listen_socket_reuseable(sock);
|
(void)evutil_make_listen_socket_reuseable(sock);
|
||||||
|
|
||||||
@@ -250,6 +254,11 @@ tr_session::tr_udp_core::tr_udp_core(tr_session& session, tr_port udp_port)
|
|||||||
event_add(udp6_event_.get(), nullptr);
|
event_add(udp6_event_.get(), nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (udp4_socket_ == TR_BAD_SOCKET && udp6_socket_ == TR_BAD_SOCKET)
|
||||||
|
{
|
||||||
|
tr_logAddError(_("Couldn't create any UDP sockets."));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tr_session::tr_udp_core::~tr_udp_core()
|
tr_session::tr_udp_core::~tr_udp_core()
|
||||||
|
|||||||
Reference in New Issue
Block a user