feat: speed up answering queries (#1255) · python-zeroconf/python-zeroconf@2d3aed3
1+2+import cython
3+4+from .._cache cimport DNSCache
5+from .._dns cimport DNSPointer, DNSQuestion, DNSRecord, DNSRRSet
6+from .._history cimport QuestionHistory
7+from .._protocol.incoming cimport DNSIncoming
8+from .._services.registry cimport ServiceRegistry
9+10+11+cdef object TYPE_CHECKING, QuestionAnswers
12+cdef cython.uint _ONE_SECOND, _TYPE_PTR, _TYPE_ANY, _TYPE_A, _TYPE_AAAA, _TYPE_SRV, _TYPE_TXT
13+cdef str _SERVICE_TYPE_ENUMERATION_NAME
14+cdef cython.set _RESPOND_IMMEDIATE_TYPES
15+16+cdef class _QueryResponse:
17+18+ cdef object _is_probe
19+ cdef DNSIncoming _msg
20+ cdef float _now
21+ cdef DNSCache _cache
22+ cdef cython.dict _additionals
23+ cdef cython.set _ucast
24+ cdef cython.set _mcast_now
25+ cdef cython.set _mcast_aggregate
26+ cdef cython.set _mcast_aggregate_last_second
27+28+ cpdef add_qu_question_response(self, cython.dict answers)
29+30+ cpdef add_ucast_question_response(self, cython.dict answers)
31+32+ cpdef add_mcast_question_response(self, cython.dict answers)
33+34+@cython.locals(maybe_entry=DNSRecord)
35+ cpdef _has_mcast_within_one_quarter_ttl(self, DNSRecord record)
36+37+@cython.locals(maybe_entry=DNSRecord)
38+ cpdef _has_mcast_record_in_last_second(self, DNSRecord record)
39+40+ cpdef answers(self)
41+42+cdef class QueryHandler:
43+44+ cdef ServiceRegistry registry
45+ cdef DNSCache cache
46+ cdef QuestionHistory question_history
47+48+ cdef _add_service_type_enumeration_query_answers(self, cython.dict answer_set, DNSRRSet known_answers)
49+50+ cdef _add_pointer_answers(self, str lower_name, cython.dict answer_set, DNSRRSet known_answers)
51+52+ cdef _add_address_answers(self, str lower_name, cython.dict answer_set, DNSRRSet known_answers, cython.uint type_)
53+54+@cython.locals(question_lower_name=str, type_=cython.uint)
55+ cdef _answer_question(self, DNSQuestion question, DNSRRSet known_answers)
56+57+@cython.locals(
58+msg=DNSIncoming,
59+question=DNSQuestion,
60+answer_set=cython.dict,
61+known_answers=DNSRRSet,
62+known_answers_set=cython.set,
63+ )
64+ cpdef async_response(self, cython.list msgs, object unicast_source)