MCPcopy Create free account
hub / github.com/apache/trafficserver / match

Method match

src/proxy/IPAllow.cc:173–198  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

171}
172
173IpAllow::ACL
174IpAllow::match(swoc::IPAddr const &addr, match_key_t key)
175{
176 self_type *self = acquire();
177 Record const *record = nullptr;
178 if (SRC_ADDR == key) {
179 if (auto spot = self->_src_map.find(addr); spot != self->_src_map.end()) {
180 auto r = std::get<1>(*spot);
181 // Special case - if checking in accept is enabled and the record is a deny all,
182 // then return a missing record instead to force an immediate deny. Otherwise it's delayed
183 // until after remap, to allow remap rules to tweak the result.
184 if (!(accept_check_p && r->_method_mask == 0 && r->_nonstandard_methods.empty())) {
185 record = r;
186 }
187 }
188 } else if (auto spot = self->_dst_map.find(addr); spot != self->_dst_map.end()) {
189 record = std::get<1>(*spot);
190 }
191
192 if (record == nullptr) {
193 self->release(); // no record, don't keep a reference to the config.
194 return {};
195 }
196
197 return ACL{record, self}; // Note this keeps the config in memory.
198}
199
200//
201// End API functions

Callers

nothing calls this directly

Calls 6

releaseMethod · 0.95
acquireFunction · 0.85
get<1>Function · 0.50
findMethod · 0.45
endMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected