From 8f0bf44fd3f08c837a8409378afd09dfb5b12f0f Mon Sep 17 00:00:00 2001 From: thlo Date: Thu, 27 Dec 2012 11:17:44 +0100 Subject: Limit HTTP server to Media Folder. Reduction of log output --- vdr-smarttvweb/smarttvfactory.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'vdr-smarttvweb/smarttvfactory.c') diff --git a/vdr-smarttvweb/smarttvfactory.c b/vdr-smarttvweb/smarttvfactory.c index 12a24bc..a57310a 100644 --- a/vdr-smarttvweb/smarttvfactory.c +++ b/vdr-smarttvweb/smarttvfactory.c @@ -144,7 +144,8 @@ void SmartTvServer::loop() { write_set = mWriteState; if (ret != handeled_fds) { - *(mLog.log()) << "ERROR: Select-ret= " << ret + // Only ok, when the server has closed a handing HTTP connection + *(mLog.log()) << "WARNING: Select-ret= " << ret << " != handeled_fds= " << handeled_fds << endl; /* FD_ZERO(&mReadState); FD_ZERO(&mWriteState); @@ -168,10 +169,10 @@ void SmartTvServer::loop() { timeout.tv_sec = 5; timeout.tv_usec = 0; - ret = select(maxfd + 1, &read_set, &write_set, NULL, &timeout); if (ret == 0) { + // timeout: Check for dead TCP connections for (uint idx= 0; idx < clientList.size(); idx++) { if (clientList[idx] != NULL) if (clientList[idx]->checkStatus() == ERROR) { @@ -194,9 +195,9 @@ void SmartTvServer::loop() { // new accept if (FD_ISSET(mServerFd, &read_set)) { + handeled_fds ++; if((rfd = accept(mServerFd, (sockaddr*)&sadr, &addr_size))!= -1){ req_id ++; - handeled_fds ++; #ifndef DEBUG *(mLog.log()) << "fd= " << rfd @@ -268,7 +269,9 @@ void SmartTvServer::loop() { continue; } if ( clientList[rfd]->handleWrite() < 0){ +#ifndef DEBUG *(mLog.log()) << "fd= " << rfd << " --------------------- Check Write: Closing ---------------------" << endl; +#endif close(rfd); delete clientList[rfd]; clientList[rfd] = NULL; -- cgit v1.2.3