Overview
Comment: | OFDNSResolver: Invalidate cache on config changes |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
3f27f9cfbdf15c6c26cc4dbcf647a09f |
User & Date: | js on 2024-01-02 17:14:31 |
Other Links: | manifest | tags |
Context
2024-01-02
| ||
17:17 | Update copyright check-in: 26ddd2e4e4 user: js tags: trunk | |
17:14 | OFDNSResolver: Invalidate cache on config changes check-in: 3f27f9cfbd user: js tags: trunk | |
14:26 | OFDNSResolver: Add warnings about config reloading check-in: b4507c354a user: js tags: trunk | |
Changes
Modified src/OFDNSResolver.h from [9ab49908f1] to [92b2145ac6].
︙ | |||
26 27 28 29 30 31 32 33 34 35 36 37 38 39 | 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | + | @class OFArray OF_GENERIC(ObjectType); @class OFDNSResolver; @class OFDNSResolverContext; @class OFDNSResolverSettings; @class OFDate; @class OFDictionary OF_GENERIC(KeyType, ObjectType); @class OFMutableArray OF_GENERIC(ObjectType); @class OFMutableDictionary OF_GENERIC(KeyType, ObjectType); @class OFNumber; @class OFPair OF_GENERIC(FirstType, SecondType); @class OFTCPSocket; @class OFUDPSocket; /** |
︙ | |||
133 134 135 136 137 138 139 140 141 142 143 144 145 146 | 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 | + | char _buffer[OFDNSResolverBufferLength]; OFMutableDictionary OF_GENERIC(OFNumber *, OFDNSResolverContext *) *_queries; OFMutableDictionary OF_GENERIC(OFTCPSocket *, OFDNSResolverContext *) *_TCPQueries; OFMutableDictionary OF_GENERIC(OFDNSQuery *, OFPair OF_GENERIC(OFDate *, OFDNSResponse *) *) *_cache; OFMutableArray OF_GENERIC(OFString *) *_lastNameServers; OFTimeInterval _lastCacheCleanup; } /** * @brief A dictionary of static hosts. * * This dictionary is checked before actually looking up a host. |
︙ | |||
161 162 163 164 165 166 167 | 163 164 165 166 167 168 169 170 171 172 173 174 175 176 | - - - - | * to disable reloading the config after some time. If you don't, the * config will be reloaded and your change overridden. */ @property (copy, nonatomic) OFArray OF_GENERIC(OFString *) *nameServers; /** * @brief The local domain. |
︙ |
Modified src/OFDNSResolver.m from [033477a200] to [002fb3b586].
︙ | |||
613 614 615 616 617 618 619 620 621 622 623 624 625 626 | 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 | + | #ifdef OF_HAVE_IPV6 [_IPv6Socket cancelAsyncRequests]; [_IPv6Socket release]; #endif [_queries release]; [_TCPQueries release]; [_cache release]; [_lastNameServers release]; [super dealloc]; } - (OFDictionary *)staticHosts { return _settings->_staticHosts; |
︙ | |||
803 804 805 806 807 808 809 | 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 | - + + + + + + + + + + + | [sock asyncReceiveIntoBuffer: _buffer length: bufferLength runLoopMode: runLoopMode]; } - (void)of_cleanUpCache { |
︙ | |||
828 829 830 831 832 833 834 | 839 840 841 842 843 844 845 846 847 848 849 850 851 852 | - - | containsExpiredRecord(response.authorityRecords, age) || containsExpiredRecord(response.additionalRecords, age)) [removeList addObject: query]; } for (OFDNSQuery *query in removeList) [_cache removeObjectForKey: query]; |
︙ | |||
1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 | 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 | + + - - | } @catch (id e) { exception = e; } if (exception != nil) response = nil; [self of_cleanUpCache]; if (response != nil) [_cache setObject: [OFPair pairWithFirstObject: [OFDate date] secondObject: response] forKey: context->_query]; else [_cache removeObjectForKey: context->_query]; |
︙ |