Example #1
0
void FileInfo::clear()
{
	clearCustomData();

	etag_ = service_.make_etag(*this);
	mtime_.clear(); // gets computed on-demand
	mimetype_ = service_.get_mimetype(path_);
}
Example #2
0
/** releases all connection resources  and triggers the onConnectionClose event.
 */
HttpConnection::~HttpConnection()
{
	if (request_)
		delete request_;

	clearCustomData();

	TRACE("destructing (rc: %ld)", refCount_);
	//TRACE("Stack Trace:\n%s", StackTrace().c_str());

	worker_->server_.onConnectionClose(this);

	delete socket_;
}
Example #3
0
/** internally invoked when the response has been <b>fully</b> flushed to the client and we're to pass control back to the underlying connection.
 *
 * The request's reply has been fully transmitted to the client, so we are to invoke the request-done callback
 * and clear request-local custom data.
 *
 * After that, the connection gets either \p close()'d or will enter \p resume() state, to receive and process the next request.
 *
 * \see finish()
 */
void HttpRequest::finalize()
{
	TRACE("finalize()");
	connection.worker().server().onRequestDone(this);
	clearCustomData();

	if (isAborted() || !connection.shouldKeepAlive()) {
		TRACE("finalize: closing");
		connection.close();
	} else {
		TRACE("finalize: resuming");
		clear();
		connection.resume();
	}
}
Example #4
0
HttpWorker::~HttpWorker()
{
	TRACE("destroying");

	clearCustomData();

	pthread_cond_destroy(&resumeCondition_);
	pthread_mutex_destroy(&resumeLock_);

	pthread_spin_destroy(&queueLock_);

	evLoopCheck_.stop();
	evNewConnection_.stop();
	evWakeup_.stop();

	ev_loop_destroy(loop_);
}
Example #5
0
HttpWorker::~HttpWorker()
{
	TRACE(1, "destroying");

	clearCustomData();

#if !defined(X0_WORKER_POST_LIBEV)
	pthread_mutex_destroy(&postLock_);
#endif

	pthread_cond_destroy(&resumeCondition_);
	pthread_mutex_destroy(&resumeLock_);

	evLoopCheck_.stop();
	evNewConnection_.stop();
	evWakeup_.stop();

	freeCache();
}
Example #6
0
/**
 * Frees up any resources and resets state of this connection.
 *
 * This method is invoked only after the connection has been closed and
 * this resource may now either be physically destructed or put into
 * a list of free connection objects for later use of newly incoming
 * connections (to avoid too many memory allocations).
 */
void HttpConnection::clear()
{
	TRACE(1, "clear(): refCount: %zu, conn.status: %s, parser.state: %s", refCount_, status_str(), state_str());
	//TRACE(1, "Stack Trace:\n%s", StackTrace().c_str());

	HttpMessageProcessor::reset();

	if (request_) {
		request_->clear();
	}

	clearCustomData();

	worker_->server_.onConnectionClose(this);
	delete socket_;
	socket_ = nullptr;
	requestCount_ = 0;

	inputOffset_ = 0;
	input_.clear();
}