async def query_consent(self):
        """
        Periodically check consent (RFC 7675).
        """
        failures = 0
        while True:
            # randomize between 0.8 and 1.2 times CONSENT_INTERVAL
            await asyncio.sleep(CONSENT_INTERVAL * (0.8 + 0.4 * random.random()))

            for pair in self._nominated.values():
                request = self.build_request(pair)
                try:
                    await pair.protocol.request(
                        request, pair.remote_addr,
                        integrity_key=self.remote_password.encode('utf8'),
                        retransmissions=0)
                    failures = 0
                except exceptions.TransactionError:
                    failures += 1
                if failures >= CONSENT_FAILURES:
                    self.__log_info('Consent to send expired')
                    self._query_consent_handle = None
                    return await self.close()
async def query_consent ( self ) : failures = 0 while True : await asyncio . sleep ( CONSENT_INTERVAL * ( 0.8 + 0.4 * random . random ( ) ) ) for pair in self . _nominated . values ( ) : request = self . build_request ( pair ) try : await pair . protocol . request ( request , pair . remote_addr , integrity_key = self . remote_password . encode ( 'utf8' ) , retransmissions = 0 ) failures = 0 except exceptions . TransactionError : failures += 1 if failures >= CONSENT_FAILURES : self . __log_info ( 'Consent to send expired' ) self . _query_consent_handle = None return await self . close ( )
Periodically check consent (RFC 7675).