Daemon doesn't send UPnP search messages
The daemon currently uses a patched version of libupnp in order to avoid using the select
system call (see #870 (closed)). Unfortunately, the patch (https://review.jami.net/c/jami-daemon/+/25292) introduced a bug in the SearchByTarget
function, which is responsible for sending UPnP search messages. Before actually trying to send a message, this function checks that it has a valid socket which is ready for writing:
if (gSsdpReqSocket4 != INVALID_SOCKET &&
FD_ISSET(gSsdpReqSocket4, &wrSet)) {
The second part of the condition (with the FD_ISSET
) was needed when using select
but no longer makes sense now that poll
is used instead. Because of it, the condition in the above if statement is now always false, which means that SearchByTarget
never sends any search messages. As a result, Jami will only find out that a router supports UPnP if that router sends a UPnP discovery message to advertise its presence. Some routers happen to send such messages frequently enough (e.g. every 30 seconds) to allow Jami to discover them reasonably quickly after starting up, but we cannot rely on this (and in any case, sending search messages will generally allow us to discover UPnP-compatible routers much faster).