MCPcopy Create free account
hub / github.com/defold/defold / SortProbeRecords

Function SortProbeRecords

engine/dlib/src/dlib/mdns.cpp:884–897  ·  view source on GitHub ↗

Record sets must be sorted before pairwise tiebreak comparison so hosts reach the same outcome even when authority records arrive in any order.

Source from the content-addressed store, hash-verified

882 // Record sets must be sorted before pairwise tiebreak comparison so hosts
883 // reach the same outcome even when authority records arrive in any order.
884 static void SortProbeRecords(ProbeRecord* records, uint32_t count)
885 {
886 for (uint32_t i = 1; i < count; ++i)
887 {
888 ProbeRecord current = records[i];
889 uint32_t j = i;
890 while (j > 0 && CompareProbeRecord(current, records[j - 1]) < 0)
891 {
892 records[j] = records[j - 1];
893 --j;
894 }
895 records[j] = current;
896 }
897 }
898
899 // Compares two sorted claim sets and returns which side is later in the
900 // RFC-defined ordering. Identical sets are not treated as conflicts.

Callers 1

CollectProbeClaimsFunction · 0.85

Calls 1

CompareProbeRecordFunction · 0.85

Tested by

no test coverage detected