@@ -14,79 +14,106 @@ cdef bint TYPE_CHECKING |
14 | 14 | cdef object cached_possible_types |
15 | 15 | cdef cython.uint _EXPIRE_REFRESH_TIME_PERCENT, _MAX_MSG_TYPICAL, _DNS_PACKET_HEADER_LEN |
16 | 16 | cdef cython.uint _TYPE_PTR |
| 17 | +cdef object _CLASS_IN |
17 | 18 | cdef object SERVICE_STATE_CHANGE_ADDED, SERVICE_STATE_CHANGE_REMOVED, SERVICE_STATE_CHANGE_UPDATED |
18 | 19 | cdef cython.set _ADDRESS_RECORD_TYPES |
| 20 | +cdef float RESCUE_RECORD_RETRY_TTL_PERCENTAGE |
| 21 | + |
| 22 | +cdef object _MDNS_PORT, _BROWSER_TIME |
| 23 | + |
| 24 | +cdef object QU_QUESTION |
| 25 | + |
| 26 | +cdef object _FLAGS_QR_QUERY |
| 27 | + |
| 28 | +cdef object heappop, heappush |
| 29 | + |
| 30 | +cdef class _ScheduledPTRQuery: |
| 31 | + |
| 32 | + cdef public str alias |
| 33 | + cdef public str name |
| 34 | + cdef public unsigned int ttl |
| 35 | + cdef public bint cancelled |
| 36 | + cdef public double expire_time_millis |
| 37 | + cdef public double when_millis |
19 | 38 |
|
20 | 39 | cdef class _DNSPointerOutgoingBucket: |
21 | 40 |
|
22 | | - cdef public object now |
| 41 | + cdef public double now_millis |
23 | 42 | cdef public DNSOutgoing out |
24 | 43 | cdef public cython.uint bytes |
25 | 44 |
|
26 | 45 | cpdef add(self, cython.uint max_compressed_size, DNSQuestion question, cython.set answers) |
27 | 46 |
|
28 | 47 | @cython.locals(cache=DNSCache, question_history=QuestionHistory, record=DNSRecord, qu_question=bint) |
29 | | -cpdef generate_service_query( |
| 48 | +cpdef list generate_service_query( |
30 | 49 | object zc, |
31 | | - double now, |
32 | | - list type_, |
| 50 | + double now_millis, |
| 51 | + set types_, |
33 | 52 | bint multicast, |
34 | 53 | object question_type |
35 | 54 | ) |
36 | 55 |
|
37 | 56 | @cython.locals(answer=DNSPointer, query_buckets=list, question=DNSQuestion, max_compressed_size=cython.uint, max_bucket_size=cython.uint, query_bucket=_DNSPointerOutgoingBucket) |
38 | | -cdef _group_ptr_queries_with_known_answers(object now, object multicast, cython.dict question_with_known_answers) |
| 57 | +cdef list _group_ptr_queries_with_known_answers(double now_millis, bint multicast, cython.dict question_with_known_answers) |
39 | 58 |
|
40 | 59 | cdef class QueryScheduler: |
41 | 60 |
|
42 | | - cdef cython.set _types |
43 | | - cdef cython.dict _next_time |
44 | | - cdef object _first_random_delay_interval |
45 | | - cdef cython.dict _delay |
| 61 | + cdef object _zc |
| 62 | + cdef set _types |
| 63 | + cdef str _addr |
| 64 | + cdef int _port |
| 65 | + cdef bint _multicast |
| 66 | + cdef tuple _first_random_delay_interval |
| 67 | + cdef double _min_time_between_queries_millis |
| 68 | + cdef object _loop |
| 69 | + cdef unsigned int _startup_queries_sent |
| 70 | + cdef public dict _next_scheduled_for_alias |
| 71 | + cdef public list _query_heap |
| 72 | + cdef object _next_run |
| 73 | + cdef double _clock_resolution_millis |
| 74 | + cdef object _question_type |
| 75 | + |
| 76 | + cpdef void schedule_ptr_first_refresh(self, DNSPointer pointer) |
| 77 | + |
| 78 | + cdef void _schedule_ptr_refresh(self, DNSPointer pointer, double expire_time_millis, double refresh_time_millis) |
| 79 | + |
| 80 | + cdef void _schedule_ptr_query(self, _ScheduledPTRQuery scheduled_query) |
46 | 81 |
|
47 | | - cpdef millis_to_wait(self, object now) |
| 82 | + @cython.locals(scheduled=_ScheduledPTRQuery) |
| 83 | + cpdef void cancel_ptr_refresh(self, DNSPointer pointer) |
48 | 84 |
|
49 | | - cpdef reschedule_type(self, object type_, object next_time) |
| 85 | + @cython.locals(current=_ScheduledPTRQuery, expire_time=double) |
| 86 | + cpdef void reschedule_ptr_first_refresh(self, DNSPointer pointer) |
50 | 87 |
|
51 | | - cpdef process_ready_types(self, object now) |
| 88 | + @cython.locals(ttl_millis='unsigned int', additional_wait=double, next_query_time=double) |
| 89 | + cpdef void schedule_rescue_query(self, _ScheduledPTRQuery query, double now_millis, float additional_percentage) |
| 90 | + |
| 91 | + cpdef void _process_startup_queries(self) |
| 92 | + |
| 93 | + @cython.locals(query=_ScheduledPTRQuery, next_scheduled=_ScheduledPTRQuery, next_when=double) |
| 94 | + cpdef void _process_ready_types(self) |
| 95 | + |
| 96 | + cpdef void async_send_ready_queries(self, bint first_request, double now_millis, set ready_types) |
52 | 97 |
|
53 | 98 | cdef class _ServiceBrowserBase(RecordUpdateListener): |
54 | 99 |
|
55 | 100 | cdef public cython.set types |
56 | 101 | cdef public object zc |
57 | 102 | cdef DNSCache _cache |
58 | 103 | cdef object _loop |
59 | | - cdef public object addr |
60 | | - cdef public object port |
61 | | - cdef public object multicast |
62 | | - cdef public object question_type |
63 | 104 | cdef public cython.dict _pending_handlers |
64 | 105 | cdef public object _service_state_changed |
65 | 106 | cdef public QueryScheduler query_scheduler |
66 | 107 | cdef public bint done |
67 | | - cdef public object _first_request |
68 | | - cdef public object _next_send_timer |
69 | 108 | cdef public object _query_sender_task |
70 | 109 |
|
71 | | - cpdef _generate_ready_queries(self, object first_request, object now) |
72 | | - |
73 | 110 | cpdef void _enqueue_callback(self, object state_change, object type_, object name) |
74 | 111 |
|
75 | 112 | @cython.locals(record_update=RecordUpdate, record=DNSRecord, cache=DNSCache, service=DNSRecord, pointer=DNSPointer) |
76 | 113 | cpdef void async_update_records(self, object zc, double now, cython.list records) |
77 | 114 |
|
78 | 115 | cpdef cython.list _names_matching_types(self, object types) |
79 | 116 |
|
80 | | - cpdef reschedule_type(self, object type_, object now, object next_time) |
81 | | - |
82 | 117 | cpdef _fire_service_state_changed_event(self, cython.tuple event) |
83 | 118 |
|
84 | | - cpdef _async_send_ready_queries_schedule_next(self) |
85 | | - |
86 | | - cpdef _async_schedule_next(self, object now) |
87 | | - |
88 | | - cpdef _async_send_ready_queries(self, object now) |
89 | | - |
90 | | - cpdef _cancel_send_timer(self) |
91 | | - |
92 | 119 | cpdef void async_update_records_complete(self) |