mirror of
https://github.com/pocoproject/poco.git
synced 2025-01-19 00:46:03 +01:00
fixed a potential endless loop in SecureStreamSocketImpl::sendBytes()
and also removed unnecessary code
This commit is contained in:
parent
0434ee2b6b
commit
476a7e4f31
@ -1,7 +1,7 @@
|
||||
//
|
||||
// SecureStreamSocketImpl.cpp
|
||||
//
|
||||
// $Id: //poco/1.4/NetSSL_OpenSSL/src/SecureStreamSocketImpl.cpp#4 $
|
||||
// $Id: //poco/1.4/NetSSL_OpenSSL/src/SecureStreamSocketImpl.cpp#6 $
|
||||
//
|
||||
// Library: NetSSL_OpenSSL
|
||||
// Package: SSLSockets
|
||||
@ -132,26 +132,7 @@ void SecureStreamSocketImpl::abort()
|
||||
|
||||
int SecureStreamSocketImpl::sendBytes(const void* buffer, int length, int flags)
|
||||
{
|
||||
const char* p = reinterpret_cast<const char*>(buffer);
|
||||
int remaining = length;
|
||||
int sent = 0;
|
||||
bool blocking = getBlocking();
|
||||
while (remaining > 0)
|
||||
{
|
||||
int n = _impl.sendBytes(p, remaining, flags);
|
||||
if (n < 0 && !blocking) return n;
|
||||
if (n > 0)
|
||||
{
|
||||
p += n;
|
||||
sent += n;
|
||||
remaining -= n;
|
||||
}
|
||||
if (blocking && remaining > 0)
|
||||
Poco::Thread::yield();
|
||||
else
|
||||
break;
|
||||
}
|
||||
return sent;
|
||||
return _impl.sendBytes(buffer, length, flags);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user