Files
QsLog
YACReader
YACReaderLibrary
comic_vine
db
server
controllers
lib
bfHttpServer
bfHttpServer.pri
httpconnectionhandler.cpp
httpconnectionhandler.h
httpconnectionhandlerpool.cpp
httpconnectionhandlerpool.h
httpcookie.cpp
httpcookie.h
httplistener.cpp
httplistener.h
httprequest.cpp
httprequest.h
httprequesthandler.cpp
httprequesthandler.h
httpresponse.cpp
httpresponse.h
httpsession.cpp
httpsession.h
httpsessionstore.cpp
httpsessionstore.h
staticfilecontroller.cpp
staticfilecontroller.h
bfLogging
bfTemplateEngine
documentcache.h
requestmapper.cpp
requestmapper.h
server.pri
startup.cpp
startup.h
static.cpp
static.h
YACReaderLibrary.icns
YACReaderLibrary.pro
add_library_dialog.cpp
add_library_dialog.h
bundle_creator.cpp
bundle_creator.h
comic_flow.cpp
comic_flow.h
comic_flow_widget.cpp
comic_flow_widget.h
comics_remover.cpp
comics_remover.h
create_library_dialog.cpp
create_library_dialog.h
db_helper.cpp
db_helper.h
export_comics_info_dialog.cpp
export_comics_info_dialog.h
export_library_dialog.cpp
export_library_dialog.h
files.qrc
icon.ico
icon.rc
icon2.ico
icon3.ico
images.qrc
images_osx.qrc
images_win.qrc
import_comics_info_dialog.cpp
import_comics_info_dialog.h
import_library_dialog.cpp
import_library_dialog.h
import_widget.cpp
import_widget.h
library_creator.cpp
library_creator.h
library_window.cpp
library_window.h
main.cpp
no_libraries_widget.cpp
no_libraries_widget.h
options_dialog.cpp
options_dialog.h
package_manager.cpp
package_manager.h
properties_dialog.cpp
properties_dialog.h
rename_library_dialog.cpp
rename_library_dialog.h
server_config_dialog.cpp
server_config_dialog.h
yacreader_libraries.cpp
yacreader_libraries.h
yacreader_local_server.cpp
yacreader_local_server.h
yacreader_main_toolbar.cpp
yacreader_main_toolbar.h
yacreaderlibrary_es.qm
yacreaderlibrary_es.ts
yacreaderlibrary_fr.ts
yacreaderlibrary_nl.ts
yacreaderlibrary_pt.ts
yacreaderlibrary_ru.ts
yacreaderlibrary_source.ts
yacreaderlibrary_tr.ts
common
compressed_archive
custom_widgets
dependencies
files
images
release
CHANGELOG.txt
COPYING.txt
INSTALL.txt
README.txt
YACReader.1
YACReader.desktop
YACReader.pro
YACReaderLibrary.1
YACReaderLibrary.desktop
background.png
cleanOSX.sh
compileOSX.sh
create-dmg
generateVS2010Projects.bat
icon.icns
mktarball.sh
releaseOSX.sh
yacreader/YACReaderLibrary/server/lib/bfHttpServer/httpconnectionhandlerpool.h
Felix Kauselmann 197660b46e Linux: install docs in a more packaging-friendly way
Linux: Add initial support for manpages
2014-08-18 00:35:26 +02:00

74 lines
2.1 KiB
C++

#ifndef HTTPCONNECTIONHANDLERPOOL_H
#define HTTPCONNECTIONHANDLERPOOL_H
#include <QList>
#include <QTimer>
#include <QObject>
#include <QMutex>
#include "httpconnectionhandler.h"
/**
Pool of http connection handlers. Connection handlers are created on demand and idle handlers are
cleaned up in regular time intervals.
<p>
Example for the required configuration settings:
<code><pre>
minThreads=1
maxThreads=100
cleanupInterval=1000
maxRequestSize=16000
maxMultiPartSize=1000000
</pre></code>
The pool is empty initially and grows with the number of concurrent
connections. A timer removes one idle connection handler at each
interval, but it leaves some spare handlers in memory to improve
performance.
@see HttpConnectionHandler for description of config settings readTimeout
@see HttpRequest for description of config settings maxRequestSize and maxMultiPartSize
*/
class HttpConnectionHandlerPool : public QObject {
Q_OBJECT
Q_DISABLE_COPY(HttpConnectionHandlerPool)
public:
/**
Constructor.
@param settings Configuration settings for the HTTP server. Must not be 0.
@param requestHandler The handler that will process each received HTTP request.
@warning The requestMapper gets deleted by the destructor of this pool
*/
HttpConnectionHandlerPool(QSettings* settings, HttpRequestHandler* requestHandler);
/** Destructor */
virtual ~HttpConnectionHandlerPool();
/** Get a free connection handler, or 0 if not available. */
HttpConnectionHandler* getConnectionHandler();
private:
/** Settings for this pool */
QSettings* settings;
/** Will be assigned to each Connectionhandler during their creation */
HttpRequestHandler* requestHandler;
/** Pool of connection handlers */
QList<HttpConnectionHandler*> pool;
/** Timer to clean-up unused connection handler */
QTimer cleanupTimer;
/** Used to synchronize threads */
QMutex mutex;
private slots:
/** Received from the clean-up timer. */
void cleanup();
};
#endif // HTTPCONNECTIONHANDLERPOOL_H