2010-10-19 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>

Don't reuse socket which is readable because we assume that if
	socket is readable it means peer shutdowns connection and the
	socket will receive EOF. Added default timeout value to
	DownloadEngine::poolSocket().
	* src/DownloadEngine.cc
	* src/DownloadEngine.h
pull/1/head
Tatsuhiro Tsujikawa 2010-10-19 14:02:47 +00:00
parent 6b74a27586
commit 51308002d3
3 changed files with 14 additions and 3 deletions

View File

@ -1,3 +1,12 @@
2010-10-19 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Don't reuse socket which is readable because we assume that if
socket is readable it means peer shutdowns connection and the
socket will receive EOF. Added default timeout value to
DownloadEngine::poolSocket().
* src/DownloadEngine.cc
* src/DownloadEngine.h
2010-10-19 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Fixed the bug that file allocation is enabled in HTTP even if

View File

@ -399,7 +399,9 @@ DownloadEngine::findSocketPoolEntry(const std::string& key)
for(std::multimap<std::string, SocketPoolEntry>::iterator i =
range.first, eoi = range.second; i != eoi; ++i) {
const SocketPoolEntry& e = (*i).second;
if(!e.isTimeout()) {
// We assume that if socket is readable it means peer shutdowns
// connection and the socket will receive EOF. So skip it.
if(!e.isTimeout() && !e.getSocket()->isReadable(0)) {
logger_->info("Found socket for %s", key.c_str());
return i;
}

View File

@ -257,7 +257,7 @@ public:
const std::string& proxyhost, uint16_t proxyport,
const SharedHandle<SocketCore>& sock,
const std::map<std::string, std::string>& options,
time_t timeout);
time_t timeout = 15);
void poolSocket(const SharedHandle<Request>& request,
const std::string& username,
@ -269,7 +269,7 @@ public:
void poolSocket(const std::string& ipaddr, uint16_t port,
const std::string& proxyhost, uint16_t proxyport,
const SharedHandle<SocketCore>& sock,
time_t timeout);
time_t timeout = 15);
void poolSocket(const SharedHandle<Request>& request,
const SharedHandle<Request>& proxyRequest,