applicationIds
https://issues.shibboleth.net/jira/browse/SSPCPP-669
Split management of disco feed files into app-specific queues
and embed applicationId hash into feed file names.
string m_dir;
bool m_cacheToClient;
#ifndef SHIBSP_LITE
string m_dir;
bool m_cacheToClient;
#ifndef SHIBSP_LITE
- // A queue of feed files, linked to the last time of "access".
+ // Application-specific queues of feed files, linked to the last time of "access".
// Each filename is also a cache tag.
// Each filename is also a cache tag.
- mutable queue< pair<string,time_t> > m_feedQueue;
+ typedef queue< pair<string, time_t> > feedqueue_t;
+ mutable map<string,feedqueue_t> m_feedQueues;
scoped_ptr<Mutex> m_feedLock;
#endif
};
scoped_ptr<Mutex> m_feedLock;
#endif
};
// Remove any files unused for more than a couple of minutes.
// Anything left will be orphaned, but that shouldn't happen too often.
time_t now = time(nullptr);
// Remove any files unused for more than a couple of minutes.
// Anything left will be orphaned, but that shouldn't happen too often.
time_t now = time(nullptr);
- while (!m_feedQueue.empty() && now - m_feedQueue.front().second > 120) {
- string fname = m_dir + '/' + m_feedQueue.front().first + ".json";
- remove(fname.c_str());
- m_feedQueue.pop();
+ for (map<string, feedqueue_t>::iterator i = m_feedQueues.begin(); i != m_feedQueues.end(); ++i) {
+ while (!i->second.empty() && now - i->second.front().second > 120) {
+ string fname = m_dir + '/' + i->second.front().first + ".json";
+ remove(fname.c_str());
+ i->second.pop();
+ }
SPConfig& conf = SPConfig::getConfig();
string s;
SPConfig& conf = SPConfig::getConfig();
string s;
s = request.getHeader("If-None-Match");
s = request.getHeader("If-None-Match");
if (conf.isEnabled(SPConfig::OutOfProcess)) {
// When out of process, we run natively and directly process the message.
if (conf.isEnabled(SPConfig::OutOfProcess)) {
// When out of process, we run natively and directly process the message.
return make_pair(true, request.sendResponse(msg, HTTPResponse::XMLTOOLING_HTTP_STATUS_NOTMODIFIED));
}
return make_pair(true, request.sendResponse(msg, HTTPResponse::XMLTOOLING_HTTP_STATUS_NOTMODIFIED));
}
- string fname = m_dir + '/' + s + ".json";
+ string fname = m_dir + '/' + request.getApplication().getHash() + '_' + s + ".json";
ifstream feed(fname.c_str());
if (!feed)
throw ConfigurationException("Unable to access cached feed in ($1).", params(1,fname.c_str()));
ifstream feed(fname.c_str());
if (!feed)
throw ConfigurationException("Unable to access cached feed in ($1).", params(1,fname.c_str()));
time_t now = time(nullptr);
// Clean up any old files.
time_t now = time(nullptr);
// Clean up any old files.
- while (m_feedQueue.size() > 1 && (now - m_feedQueue.front().second > 120)) {
- string fname = m_dir + '/' + m_feedQueue.front().first + ".json";
+ feedqueue_t q = m_feedQueues[application.getId()];
+ while (q.size() > 1 && (now - q.front().second > 120)) {
+ string fname = m_dir + '/' + application.getHash() + '_' + q.front().first + ".json";
- if (m_feedQueue.empty() || m_feedQueue.back().first != feedTag) {
+ if (q.empty() || q.back().first != feedTag) {
- string fname = m_dir + '/' + feedTag + ".json";
+ string fname = m_dir + '/' + application.getHash() + '_' + feedTag + ".json";
ofstream ofile(fname.c_str());
if (!ofile)
throw ConfigurationException("Unable to create feed in ($1).", params(1,fname.c_str()));
ofstream ofile(fname.c_str());
if (!ofile)
throw ConfigurationException("Unable to create feed in ($1).", params(1,fname.c_str()));
else
ofile << "[\n]";
ofile.close();
else
ofile << "[\n]";
ofile.close();
- m_feedQueue.push(make_pair(feedTag, now));
+ q.push(make_pair(feedTag, now));
}
else {
// Update the back of the queue.
}
else {
// Update the back of the queue.
- m_feedQueue.back().second = now;
}
#else
throw ConfigurationException("Build does not support discovery feed.");
}
#else
throw ConfigurationException("Build does not support discovery feed.");