| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -479,7 +479,7 @@ async def async_update_service(self, info: ServiceInfo) -> Awaitable: | |||
| 479 | 479 | return asyncio.ensure_future(self._async_broadcast_service(info, _REGISTER_TIME, None)) | |
| 480 | 480 | ||
| 481 | 481 | async def async_wait(self, timeout: float) -> None: | |
| 482 | - """Suspend the calling task for timeout milliseconds, or less when notified.""" | ||
| 482 | + """Pause until notified or until timeout milliseconds pass.""" | ||
| 483 | 483 | loop = self.loop | |
| 484 | 484 | assert loop is not None | |
| 485 | 485 | await wait_for_future_set_or_timeout(loop, self._notify_futures, timeout) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -243,14 +243,13 @@ def _repr_with(self, *details: tuple[str, str]) -> str: | |||
| 243 | 243 | return _format_display(type(self).__name__, [*self._display_fields(), *details]) | |
| 244 | 244 | ||
| 245 | 245 | def _set_created_ttl(self, created: _float, ttl: _int) -> None: | |
| 246 | - """Set the created and ttl of a record.""" | ||
| 247 | 246 | # It would be better if we made a copy instead of mutating the record | |
| 248 | 247 | # in place, but records currently don't have a copy method. | |
| 249 | 248 | self.created = created | |
| 250 | 249 | self.ttl = ttl | |
| 251 | 250 | ||
| 252 | 251 | def _suppressed_by_answer(self, answer: DNSRecord) -> bool: | |
| 253 | - """RFC 6762 section 7.1 known answer test: an equal record whose TTL is at least half of ours.""" | ||
| 252 | + """RFC 6762 section 7.1 known answer test: an equal record with more than half our TTL.""" | ||
| 254 | 253 | return self == answer and self.ttl / 2 < answer.ttl | |
| 255 | 254 | ||
| 256 | 255 | ||
@@ -345,7 +344,6 @@ def __repr__(self) -> str: | |||
| 345 | 344 | return self._repr_with(("cpu", self.cpu), ("os", self.os)) | |
| 346 | 345 | ||
| 347 | 346 | def write(self, out: DNSOutgoing) -> None: | |
| 348 | - """Write the rdata to an outgoing packet.""" | ||
| 349 | 347 | out.write_character_string(self.cpu.encode("utf-8")) | |
| 350 | 348 | out.write_character_string(self.os.encode("utf-8")) | |
| 351 | 349 | ||
@@ -392,7 +390,6 @@ def __repr__(self) -> str: | |||
| 392 | 390 | return self._repr_with(("next_name", self.next_name), ("covers", covered)) | |
| 393 | 391 | ||
| 394 | 392 | def write(self, out: DNSOutgoing) -> None: | |
| 395 | - """Write the rdata to an outgoing packet.""" | ||
| 396 | 393 | bitmap = bytearray(b"\0" * 32) | |
| 397 | 394 | total_octets = 0 | |
| 398 | 395 | for rdtype in self.rdtypes: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -82,20 +82,20 @@ class DNSOutgoing: | |||
| 82 | 82 | ) | |
| 83 | 83 | ||
| 84 | 84 | def __init__(self, flags: int, multicast: bool = True, id_: int = 0) -> None: | |
| 85 | - self.flags = flags | ||
| 86 | 85 | self.finished = False | |
| 86 | + self.flags = flags | ||
| 87 | 87 | self.id = id_ | |
| 88 | 88 | self.multicast = multicast | |
| 89 | 89 | self.packets_data: list[bytes] = [] | |
| 90 | + self.state = STATE_INIT | ||
| 90 | 91 | ||
| 91 | - # these 3 are per-packet -- see also _reset_for_next_packet() | ||
| 92 | - self.names: dict[str, int] = {} | ||
| 92 | + # per-packet state -- see also _reset_for_next_packet() | ||
| 93 | + self.allow_long: bool = True | ||
| 93 | 94 | self.data: list[bytes] = [] | |
| 95 | + self.names: dict[str, int] = {} | ||
| 94 | 96 | self.size: int = _DNS_PACKET_HEADER_LEN | |
| 95 | - self.allow_long: bool = True | ||
| 96 | - | ||
| 97 | - self.state = STATE_INIT | ||
| 98 | 97 | ||
| 98 | + # the four sections in RFC 1035 section 4.1 order | ||
| 99 | 99 | self.questions: list[DNSQuestion] = [] | |
| 100 | 100 | self.answers: list[tuple[DNSRecord, float]] = [] | |
| 101 | 101 | self.authorities: list[DNSPointer] = [] | |
@@ -388,10 +388,10 @@ def _replace_short(self, index: int_, value: int_) -> None: | |||
| 388 | 388 | self.data[index] = self._get_short(value) | |
| 389 | 389 | ||
| 390 | 390 | def _reset_for_next_packet(self) -> None: | |
| 391 | - self.names = {} | ||
| 391 | + self.allow_long = True | ||
| 392 | 392 | self.data = [] | |
| 393 | + self.names = {} | ||
| 393 | 394 | self.size = _DNS_PACKET_HEADER_LEN | |
| 394 | - self.allow_long = True | ||
| 395 | 395 | ||
| 396 | 396 | def _write_answers_from_offset(self, answer_offset: int_) -> int: | |
| 397 | 397 | answers_written = 0 | |
| Back | FazBrowse Home | New Git URL |
0 commit comments