| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -77,7 +77,7 @@ def async_add_records(self, entries: Iterable[DNSRecord]) -> bool: | |||
| 77 | 77 | return new | |
| 78 | 78 | ||
| 79 | 79 | def async_all_by_details(self, name: _str, type_: _int, class_: _int) -> list[DNSRecord]: | |
| 80 | - """Gets all matching entries by details. | ||
| 80 | + """Return every cached record carrying this name, type and class. | ||
| 81 | 81 | ||
| 82 | 82 | This function is not thread-safe and must be called from | |
| 83 | 83 | the event loop. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -247,8 +247,9 @@ def async_response( # pylint: disable=unused-argument | |||
| 247 | 247 | continue | |
| 248 | 248 | if ucast_source: | |
| 249 | 249 | query_res.add_ucast_question_response(answer_set) | |
| 250 | - # We always multicast as well even if its a unicast | ||
| 251 | - # source as long as we haven't done it recently (75% of ttl) | ||
| 250 | + # The answer also goes out by multicast even for a unicast | ||
| 251 | + # source; a copy multicast within the last second is folded | ||
| 252 | + # into the aggregated response instead (RFC 6762 section 14) | ||
| 252 | 253 | query_res.add_mcast_question_response(answer_set) | |
| 253 | 254 | ||
| 254 | 255 | return query_res.answers() | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -90,7 +90,9 @@ cdef class ServiceInfo(RecordUpdateListener): | |||
| 90 | 90 | ||
| 91 | 91 | @cython.locals( | |
| 92 | 92 | length="unsigned char", | |
| 93 | - index="unsigned int", | ||
| 93 | + pos="unsigned int", | ||
| 94 | + start="unsigned int", | ||
| 95 | + total="unsigned int", | ||
| 94 | 96 | key_value=bytes, | |
| 95 | 97 | key=bytes, | |
| 96 | 98 | sep=bytes, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1044,26 +1044,26 @@ def _set_text(self, text: bytes) -> None: | |||
| 1044 | 1044 | def _unpack_text_into_properties(self) -> None: | |
| 1045 | 1045 | """Unpacks the text field into properties""" | |
| 1046 | 1046 | text = self.text | |
| 1047 | - end = len(text) | ||
| 1048 | - if end == 0: | ||
| 1047 | + total = len(text) | ||
| 1048 | + if total == 0: | ||
| 1049 | 1049 | # Properties should be set atomically | |
| 1050 | 1050 | # in case another thread is reading them | |
| 1051 | 1051 | self._properties = {} | |
| 1052 | 1052 | return | |
| 1053 | 1053 | ||
| 1054 | - index = 0 | ||
| 1055 | 1054 | properties: dict[bytes, bytes | None] = {} | |
| 1056 | - while index < end: | ||
| 1057 | - length = text[index] | ||
| 1058 | - index += 1 | ||
| 1059 | - key_value = text[index : index + length] | ||
| 1055 | + pos = 0 | ||
| 1056 | + while pos < total: | ||
| 1057 | + length = text[pos] | ||
| 1058 | + start = pos + 1 | ||
| 1059 | + key_value = text[start : start + length] | ||
| 1060 | + pos = start + length | ||
| 1060 | 1061 | key, sep, value = key_value.partition(b"=") | |
| 1061 | 1062 | if key not in properties: | |
| 1062 | 1063 | # RFC 6763 section 6.4 distinguishes a key with no '=' (a | |
| 1063 | 1064 | # boolean attribute: present, no value) from `key=` (present | |
| 1064 | 1065 | # with an empty value), so test the separator, not the value. | |
| 1065 | 1066 | properties[key] = value if sep else None | |
| 1066 | - index += length | ||
| 1067 | 1067 | ||
| 1068 | 1068 | self._properties = properties | |
| 1069 | 1069 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments