Skip to content

Commit

Permalink
fix early break
Browse files Browse the repository at this point in the history
  • Loading branch information
john30 committed Sep 12, 2024
1 parent 52c3060 commit 59edf1a
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/lib/utils/tcpsocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -611,9 +611,6 @@ int resolveMdnsOneShot(const char* url, mdns_oneshot_t *result, mdns_oneshot_t *
if (!found && (!limitId.length() || limitId.compare(id) == 0)) {
storeTo = result;
found = true;
if (limitId.length()) {
break; // found the desired one, no need to wait for another
}
} else if (found && strcmp(id, result->id) == 0) {
// skip duplicate answer
continue;
Expand All @@ -632,8 +629,8 @@ int resolveMdnsOneShot(const char* url, mdns_oneshot_t *result, mdns_oneshot_t *
storeTo->address = validAddress;
strncpy(storeTo->id, id, sizeof(mdns_oneshot_t::id));
strncpy(storeTo->proto, proto, sizeof(mdns_oneshot_t::proto));
if (found && moreRemain == 0) {
break;
if (found && (limitId.length() || !moreRemain)) {
break; // found the desired one or no more space left for others
}
}
}
Expand Down

0 comments on commit 59edf1a

Please sign in to comment.