HttpServer::HttpServer() : QTcpServer(), ThreadPool("HTTP") { setMaxPendingConnections(20); InitializeThreads(); // ---------------------------------------------------------------------- // Build Platform String // ---------------------------------------------------------------------- #ifdef USING_MINGW g_sPlatform = QString( "Windows %1.%1" ) .arg(LOBYTE(LOWORD(GetVersion()))) .arg(HIBYTE(LOWORD(GetVersion()))); #else struct utsname uname_info; uname( &uname_info ); g_sPlatform = QString( "%1 %2" ).arg( uname_info.sysname ) .arg( uname_info.release ); #endif // ---------------------------------------------------------------------- // Initialize Share Path // ---------------------------------------------------------------------- m_sSharePath = GetShareDir(); VERBOSE(VB_UPNP, QString( "HttpServer() - SharePath = %1") .arg(m_sSharePath)); // -=>TODO: Load Config XML // -=>TODO: Load & initialize - HttpServerExtensions }
HttpServer::HttpServer(const QString &sApplicationPrefix) : ServerPool(), m_sSharePath(GetShareDir()), m_pHtmlServer(new HtmlServerExtension(m_sSharePath, sApplicationPrefix)), m_threadPool("HttpServerPool"), m_running(true) { setMaxPendingConnections(20); // ---------------------------------------------------------------------- // Build Platform String // ---------------------------------------------------------------------- { QMutexLocker locker(&s_platformLock); #ifdef _WIN32 s_platform = QString("Windows %1.%2") .arg(LOBYTE(LOWORD(GetVersion()))) .arg(HIBYTE(LOWORD(GetVersion()))); #else struct utsname uname_info; uname( &uname_info ); s_platform = QString("%1 %2") .arg(uname_info.sysname).arg(uname_info.release); #endif } LOG(VB_UPNP, LOG_INFO, QString("HttpServer() - SharePath = %1") .arg(m_sSharePath)); // -=>TODO: Load Config XML // -=>TODO: Load & initialize - HttpServerExtensions }
QTRServer::QTRServer(QObject *parent) : QTcpServer(parent) { data.settings = new QSettings("/etc/qtracker.conf", QSettings::IniFormat, this); //read global configuration defaultPort = data.settings->value("global/port", 80).toInt(); maxWorkerThreads = data.settings->value("global/max_worker_threads", 25).toInt(); //write basic configuration data.settings->setValue("global/port", defaultPort ); data.settings->setValue("global/max_worker_threads", maxWorkerThreads); data.settings->sync(); data.db_gate = new DBUnsorted(&data, this); data.sockets = new QSemaphore(800); data.log_error = &log_error; reloadAndClean(); connect(&cfgTimer, SIGNAL(timeout()), this, SLOT(reloadAndClean())); setMaxPendingConnections(maxWorkerThreads); threadPool = new QThreadPool(this); threadPool->setMaxThreadCount(maxWorkerThreads); }
KDSoapServer::KDSoapServer(QObject* parent) : QTcpServer(parent), d(new KDSoapServer::Private) { // Probably not very useful since we handle them immediately, but cannot hurt. setMaxPendingConnections(1000); }
InteractiveSMTPServer::InteractiveSMTPServer( QObject* parent ) : QTcpServer( parent ) { listen( localhost, 2525 ); setMaxPendingConnections( 1 ); connect( this, SIGNAL(newConnection()), this, SLOT(newConnectionAvailable()) ); }
Server::Server(const QString &file, QObject *parent) : QTcpServer(parent), m_file(file) { setMaxPendingConnections(1); // No DoS attack ((: m_file.open(QIODevice::ReadOnly); m_map = m_file.map(0,m_file.size()); m_blocks = m_file.size()/MAX_DATA_SIZE; m_lastblock = m_file.size() - (MAX_DATA_SIZE * m_blocks); connect(this,SIGNAL(newConnection()), this, SLOT(createNewClient())); }
glgrServer::glgrServer(QObject *parent) : QTcpServer(parent) { setMaxPendingConnections(MAXCONN); connect(this, SIGNAL(newConnection()), this, SLOT(NewConnection())); s = NULL; bool ok = listen(QHostAddress::Any, PORT); if (!ok) { qWarning("glgrserver: Failed to listen to port %d", PORT); exit(1); } }
WebSocketServer::WebSocketServer() : ServerPool(), m_threadPool("WebSocketServerPool"), m_running(true) { setObjectName("WebSocketServer"); // Number of connections processed concurrently int maxThreads = qMax(QThread::idealThreadCount() * 2, 2); // idealThreadCount can return -1 // Don't allow more connections than we can process, it will simply cause // browsers to stall setMaxPendingConnections(maxThreads); m_threadPool.setMaxThreadCount(maxThreads); LOG(VB_HTTP, LOG_NOTICE, QString("WebSocketServer(): Max Thread Count %1") .arg(m_threadPool.maxThreadCount())); }
HttpServer::HttpServer(QObject* parent ) : QTcpServer(parent), m_connectionCount(0), m_disabled(false), m_incomingConnectionQueue(nullptr), m_webAppSet() { qRegisterMetaType<qintptr>("qintptr"); qRegisterMetaType<HttpRequest>("HttpRequest"); qRegisterMetaType<HttpResponse>("HttpResponse"); setMaxPendingConnections(20000); m_incomingConnectionQueue = new IncomingConnectionQueue(this); }
GKSServer::GKSServer(QObject *parent) : QTcpServer(parent) { setMaxPendingConnections(MAXCONN); connect(this, SIGNAL(newConnection()), this, SLOT(connectSocket())); s = NULL; bool ok = listen(QHostAddress::Any, PORT); if (!ok) { qWarning("GKSserver: Failed to listen to port %d", PORT); exit(1); } dl = (char *) malloc(SIZE); dl_size = SIZE; nbyte = 0; ba = (char *) malloc(SIZE); ba_size = SIZE; keepOnDisplay = false; }
HttpServer::HttpServer() : QTcpServer(), ThreadPool("HTTP") { setMaxPendingConnections(20); InitializeThreads(); // ---------------------------------------------------------------------- // Build Platform String // ---------------------------------------------------------------------- #ifdef USING_MINGW g_sPlatform = QString( "Windows %1.%2" ) .arg(LOBYTE(LOWORD(GetVersion()))) .arg(HIBYTE(LOWORD(GetVersion()))); #else struct utsname uname_info; uname( &uname_info ); g_sPlatform = QString( "%1 %2" ).arg( uname_info.sysname ) .arg( uname_info.release ); #endif // ---------------------------------------------------------------------- // Initialize Share Path // ---------------------------------------------------------------------- m_sSharePath = GetShareDir(); VERBOSE(VB_UPNP, QString( "HttpServer() - SharePath = %1") .arg(m_sSharePath)); // ---------------------------------------------------------------------- // The HtmlServer Extension is our fall back if a request isn't processed // by any other extension. (This is needed here since it listens for // '/' as it's base url ). // ---------------------------------------------------------------------- m_pHtmlServer = new HtmlServerExtension( m_sSharePath ); // -=>TODO: Load Config XML // -=>TODO: Load & initialize - HttpServerExtensions }
TcpServer::TcpServer(QObject *parent,int numConnections) : QTcpServer(parent) { tcpClient = new QHash<int,TcpSocket *>; setMaxPendingConnections(numConnections); }