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