mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-29 12:18:01 +01:00
committed by
Alex Fabijanic
parent
c8af3f1c92
commit
f140808fab
@@ -490,7 +490,7 @@ protected:
|
|||||||
void reset(poco_socket_t fd = POCO_INVALID_SOCKET);
|
void reset(poco_socket_t fd = POCO_INVALID_SOCKET);
|
||||||
/// Allows subclasses to set the socket manually, iff no valid socket is set yet.
|
/// Allows subclasses to set the socket manually, iff no valid socket is set yet.
|
||||||
|
|
||||||
void checkBrokenTimeout();
|
void checkBrokenTimeout(const SelectMode& mode);
|
||||||
|
|
||||||
static int lastError();
|
static int lastError();
|
||||||
/// Returns the last error code.
|
/// Returns the last error code.
|
||||||
|
|||||||
@@ -306,13 +306,14 @@ void SocketImpl::shutdown()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SocketImpl::checkBrokenTimeout()
|
void SocketImpl::checkBrokenTimeout(const SelectMode& mode)
|
||||||
{
|
{
|
||||||
if (_isBrokenTimeout)
|
if (_isBrokenTimeout)
|
||||||
{
|
{
|
||||||
if (_recvTimeout.totalMicroseconds() != 0)
|
Poco::Timespan timeout = (mode == SelectMode::SELECT_READ) ? _recvTimeout : _sndTimeout;
|
||||||
|
if (timeout.totalMicroseconds() != 0)
|
||||||
{
|
{
|
||||||
if (!poll(_recvTimeout, SELECT_READ))
|
if (!poll(timeout, mode))
|
||||||
throw TimeoutException();
|
throw TimeoutException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -321,7 +322,7 @@ void SocketImpl::checkBrokenTimeout()
|
|||||||
|
|
||||||
int SocketImpl::sendBytes(const void* buffer, int length, int flags)
|
int SocketImpl::sendBytes(const void* buffer, int length, int flags)
|
||||||
{
|
{
|
||||||
checkBrokenTimeout();
|
checkBrokenTimeout(SELECT_WRITE);
|
||||||
|
|
||||||
int rc;
|
int rc;
|
||||||
do
|
do
|
||||||
@@ -337,7 +338,7 @@ int SocketImpl::sendBytes(const void* buffer, int length, int flags)
|
|||||||
|
|
||||||
int SocketImpl::sendBytes(const SocketBufVec& buffers, int flags)
|
int SocketImpl::sendBytes(const SocketBufVec& buffers, int flags)
|
||||||
{
|
{
|
||||||
checkBrokenTimeout();
|
checkBrokenTimeout(SELECT_WRITE);
|
||||||
|
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
do
|
do
|
||||||
@@ -362,7 +363,7 @@ int SocketImpl::sendBytes(const SocketBufVec& buffers, int flags)
|
|||||||
|
|
||||||
int SocketImpl::receiveBytes(void* buffer, int length, int flags)
|
int SocketImpl::receiveBytes(void* buffer, int length, int flags)
|
||||||
{
|
{
|
||||||
checkBrokenTimeout();
|
checkBrokenTimeout(SELECT_READ);
|
||||||
|
|
||||||
int rc;
|
int rc;
|
||||||
do
|
do
|
||||||
@@ -387,7 +388,7 @@ int SocketImpl::receiveBytes(void* buffer, int length, int flags)
|
|||||||
|
|
||||||
int SocketImpl::receiveBytes(SocketBufVec& buffers, int flags)
|
int SocketImpl::receiveBytes(SocketBufVec& buffers, int flags)
|
||||||
{
|
{
|
||||||
checkBrokenTimeout();
|
checkBrokenTimeout(SELECT_READ);
|
||||||
|
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
do
|
do
|
||||||
@@ -516,7 +517,7 @@ int SocketImpl::receiveFrom(void* buffer, int length, SocketAddress& address, in
|
|||||||
|
|
||||||
int SocketImpl::receiveFrom(void* buffer, int length, struct sockaddr** ppSA, poco_socklen_t** ppSALen, int flags)
|
int SocketImpl::receiveFrom(void* buffer, int length, struct sockaddr** ppSA, poco_socklen_t** ppSALen, int flags)
|
||||||
{
|
{
|
||||||
checkBrokenTimeout();
|
checkBrokenTimeout(SELECT_READ);
|
||||||
int rc;
|
int rc;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
@@ -555,7 +556,7 @@ int SocketImpl::receiveFrom(SocketBufVec& buffers, SocketAddress& address, int f
|
|||||||
|
|
||||||
int SocketImpl::receiveFrom(SocketBufVec& buffers, struct sockaddr** pSA, poco_socklen_t** ppSALen, int flags)
|
int SocketImpl::receiveFrom(SocketBufVec& buffers, struct sockaddr** pSA, poco_socklen_t** ppSALen, int flags)
|
||||||
{
|
{
|
||||||
checkBrokenTimeout();
|
checkBrokenTimeout(SELECT_READ);
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user