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

Function CompareProbeRecord

engine/dlib/src/dlib/mdns.cpp:869–880  ·  view source on GitHub ↗

Records sort by class, then type, then raw rdata bytes, matching the simultaneous-probe tiebreak order from RFC 6762 section 8.2.

Source from the content-addressed store, hash-verified

867 // Records sort by class, then type, then raw rdata bytes, matching the
868 // simultaneous-probe tiebreak order from RFC 6762 section 8.2.
869 static int CompareProbeRecord(const ProbeRecord& a, const ProbeRecord& b)
870 {
871 const uint16_t a_class = a.m_Class & ~DNS_CLASS_FLUSH;
872 const uint16_t b_class = b.m_Class & ~DNS_CLASS_FLUSH;
873 if (a_class != b_class)
874 return a_class < b_class ? -1 : 1;
875
876 if (a.m_Type != b.m_Type)
877 return a.m_Type < b.m_Type ? -1 : 1;
878
879 return CompareProbeData(a.m_RData, a.m_RDataLength, b.m_RData, b.m_RDataLength);
880 }
881
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.

Callers 3

SortProbeRecordsFunction · 0.85
CompareProbeRecordSetsFunction · 0.85

Calls 1

CompareProbeDataFunction · 0.85

Tested by

no test coverage detected