mirror of
https://github.com/pocoproject/poco.git
synced 2025-04-15 22:50:36 +02:00
fixed SF# 1956300: HTTPServerConnection hanging
This commit is contained in:
parent
2ba1d4181f
commit
4ec68cecaf
@ -1,7 +1,7 @@
|
||||
//
|
||||
// HTTPSession.h
|
||||
//
|
||||
// $Id: //poco/svn/Net/include/Poco/Net/HTTPSession.h#2 $
|
||||
// $Id: //poco/Main/Net/include/Poco/Net/HTTPSession.h#5 $
|
||||
//
|
||||
// Library: Net
|
||||
// Package: HTTP
|
||||
@ -140,6 +140,9 @@ protected:
|
||||
|
||||
int receive(char* buffer, int length);
|
||||
/// Reads up to length bytes.
|
||||
|
||||
int buffered() const;
|
||||
/// Returns the number of bytes in the buffer.
|
||||
|
||||
StreamSocket& socket();
|
||||
/// Returns a reference to the underlying socket.
|
||||
@ -208,6 +211,12 @@ inline const Poco::Exception* HTTPSession::networkException() const
|
||||
}
|
||||
|
||||
|
||||
inline int HTTPSession::buffered() const
|
||||
{
|
||||
return static_cast<int>(_pEnd - _pCurrent);
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::Net
|
||||
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
//
|
||||
// HTTPServerSession.cpp
|
||||
//
|
||||
// $Id: //poco/svn/Net/src/HTTPServerSession.cpp#2 $
|
||||
// $Id: //poco/Main/Net/src/HTTPServerSession.cpp#9 $
|
||||
//
|
||||
// Library: Net
|
||||
// Package: HTTPServer
|
||||
@ -70,7 +70,7 @@ bool HTTPServerSession::hasMoreRequests()
|
||||
{
|
||||
if (_maxKeepAliveRequests > 0)
|
||||
--_maxKeepAliveRequests;
|
||||
return socket().poll(_keepAliveTimeout, Socket::SELECT_READ);
|
||||
return buffered() > 0 || socket().poll(_keepAliveTimeout, Socket::SELECT_READ);
|
||||
}
|
||||
else return false;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user