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

Function reloadUrlRewrite

src/proxy/ReverseProxy.cc:137–170  ·  view source on GitHub ↗

Called when the remap.config file changes. Since it called infrequently, we do the load of new file as blocking I/O and lock acquire is also blocking. */

Source from the content-addressed store, hash-verified

135
136*/
137bool
138reloadUrlRewrite()
139{
140 UrlRewrite *newTable, *oldTable;
141
142 Note("%s loading ...", ts::filename::REMAP);
143 Dbg(dbg_ctl_url_rewrite, "%s updated, reloading...", ts::filename::REMAP);
144 newTable = new UrlRewrite();
145 if (newTable->load()) {
146 static const char *msg_format = "%s finished loading";
147
148 // Hold at least one lease, until we reload the configuration
149 newTable->acquire();
150
151 // Swap configurations
152 oldTable = ink_atomic_swap(&rewrite_table, newTable);
153
154 ink_assert(oldTable != nullptr);
155
156 // Release the old one
157 oldTable->release();
158
159 Dbg(dbg_ctl_url_rewrite, msg_format, ts::filename::REMAP);
160 Note(msg_format, ts::filename::REMAP);
161 return true;
162 } else {
163 static const char *msg_format = "%s failed to load";
164
165 delete newTable;
166 Dbg(dbg_ctl_url_rewrite, msg_format, ts::filename::REMAP);
167 Error(msg_format, ts::filename::REMAP);
168 return false;
169 }
170}
171
172int
173url_rewrite_CB(const char * /* name ATS_UNUSED */, RecDataT /* data_type ATS_UNUSED */, RecData data, void *cookie)

Callers 1

file_update_handlerMethod · 0.85

Calls 5

ink_atomic_swapFunction · 0.85
ErrorClass · 0.50
loadMethod · 0.45
acquireMethod · 0.45
releaseMethod · 0.45

Tested by

no test coverage detected