Example #1
0
void VTable::setFrameNum(int index, int pNum){
	unsigned x = pNum;
	if(ifPresent(index))
		B_SET(x, 31);
	if(ifModified(index))
		B_SET(x, 30);
	if(ifReferenced(index))
		B_SET(x, 29);
	if(ifPageout(index))
		B_SET(x, 28);

	vTable[index] = x;
}
Example #2
0
/*!
 * Универсальный метод для отдачи тела фида.
 */
bool FeedHandler::serveFeed(ChatChannel channel, const QString &feedName)
{
  if (!ifMethodAllowed())
    return true;

  if (!channel || !channel->feeds().all().contains(feedName)) {
    setNoStore();
    m_response->writeHead(Tufao::HttpServerResponse::NOT_FOUND);
    m_response->end();
    return true;
  }

  FeedPtr feed = channel->feed(feedName);
  qint64 date  = feed->head().date();

  RestReplyCache &cache = m_cache[channel->id() + feedName.toUtf8()];
  if (cache.date != date) {
    cache.date = date;
    cache.etag = etag(date, m_path.toUtf8());

    cache.body = JSON::generate(feed->feed());
  }

  setLastModified(date);
  setETag(cache.etag);
  setNoCache();

  if (!ifModified(cache.etag)) {
    m_response->writeHead(Tufao::HttpServerResponse::NOT_MODIFIED);
    m_response->end();
    return true;
  }

  m_response->writeHead(Tufao::HttpServerResponse::OK);
  if (m_request->method() != "HEAD") {
    setContentLength(cache.body.size());
    m_response->end(cache.body);
  }
  else
    m_response->end();

  return true;
}
Example #3
0
void VTable::testShow(){
	for(int i = 0; i < 64; i++){
		cout << ifPresent(i) << " " << ifModified(i) << " " << ifReferenced(i)
			<< " " << ifPageout(i) << " " << getFrameNum(i) << endl;
	}
}