diff options
author | becks <becks@yandex-team.ru> | 2022-02-10 16:47:57 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:47:57 +0300 |
commit | 86d17ce35561f39e8fb1dcf1b3340a48db69dfae (patch) | |
tree | c0748b5dcbade83af788c0abfa89c0383d6b779c /contrib/libs/poco | |
parent | dab0ded2f3bec93f337adc3dd3e17edf64b6da09 (diff) | |
download | ydb-86d17ce35561f39e8fb1dcf1b3340a48db69dfae.tar.gz |
Restoring authorship annotation for <becks@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/libs/poco')
8 files changed, 95 insertions, 95 deletions
diff --git a/contrib/libs/poco/Net/include/Poco/Net/HTTPHeaderStream.h b/contrib/libs/poco/Net/include/Poco/Net/HTTPHeaderStream.h index c476790ce0..f3f4c891b6 100644 --- a/contrib/libs/poco/Net/include/Poco/Net/HTTPHeaderStream.h +++ b/contrib/libs/poco/Net/include/Poco/Net/HTTPHeaderStream.h @@ -50,7 +50,7 @@ protected: private: HTTPSession& _session; bool _end; - bool _line_ended; + bool _line_ended; }; diff --git a/contrib/libs/poco/Net/include/Poco/Net/SocketImpl.h b/contrib/libs/poco/Net/include/Poco/Net/SocketImpl.h index 2c8bc89380..d1fec1de7d 100644 --- a/contrib/libs/poco/Net/include/Poco/Net/SocketImpl.h +++ b/contrib/libs/poco/Net/include/Poco/Net/SocketImpl.h @@ -213,9 +213,9 @@ public: /// Returns true if the next operation corresponding to /// mode will not block, false otherwise. - bool pollImpl(Poco::Timespan& timeout, int mode); - /// Modifies `timeout` - + bool pollImpl(Poco::Timespan& timeout, int mode); + /// Modifies `timeout` + virtual void setSendBufferSize(int size); /// Sets the size of the send buffer. @@ -450,7 +450,7 @@ protected: static void error(int code, const std::string& arg); /// Throws an appropriate exception for the given error code. -protected: +protected: SocketImpl(const SocketImpl&); SocketImpl& operator = (const SocketImpl&); diff --git a/contrib/libs/poco/Net/src/HTTPHeaderStream.cpp b/contrib/libs/poco/Net/src/HTTPHeaderStream.cpp index 8f3956ce6c..7d8279bc80 100644 --- a/contrib/libs/poco/Net/src/HTTPHeaderStream.cpp +++ b/contrib/libs/poco/Net/src/HTTPHeaderStream.cpp @@ -28,8 +28,8 @@ namespace Net { HTTPHeaderStreamBuf::HTTPHeaderStreamBuf(HTTPSession& session, openmode mode): HTTPBasicStreamBuf(HTTPBufferAllocator::BUFFER_SIZE, mode), _session(session), - _end(false), - _line_ended(true) + _end(false), + _line_ended(true) { } @@ -56,9 +56,9 @@ int HTTPHeaderStreamBuf::readFromDevice(char* buffer, std::streamsize length) if (ch != eof) { *buffer++ = (char) ch; ++n; - if (n == 2) _end = _line_ended; + if (n == 2) _end = _line_ended; } - _line_ended = (ch == '\n'); + _line_ended = (ch == '\n'); return n; } diff --git a/contrib/libs/poco/Net/src/SocketImpl.cpp b/contrib/libs/poco/Net/src/SocketImpl.cpp index be45597754..92c664ec82 100644 --- a/contrib/libs/poco/Net/src/SocketImpl.cpp +++ b/contrib/libs/poco/Net/src/SocketImpl.cpp @@ -449,7 +449,7 @@ bool SocketImpl::secure() const } -bool SocketImpl::pollImpl(Poco::Timespan& remainingTime, int mode) +bool SocketImpl::pollImpl(Poco::Timespan& remainingTime, int mode) { poco_socket_t sockfd = _sockfd; if (sockfd == POCO_INVALID_SOCKET) throw InvalidSocketException(); @@ -580,11 +580,11 @@ bool SocketImpl::pollImpl(Poco::Timespan& remainingTime, int mode) #endif // POCO_HAVE_FD_EPOLL } -bool SocketImpl::poll(const Poco::Timespan& timeout, int mode) -{ - Poco::Timespan remainingTime(timeout); - return pollImpl(remainingTime, mode); -} +bool SocketImpl::poll(const Poco::Timespan& timeout, int mode) +{ + Poco::Timespan remainingTime(timeout); + return pollImpl(remainingTime, mode); +} void SocketImpl::setSendBufferSize(int size) { @@ -616,13 +616,13 @@ int SocketImpl::getReceiveBufferSize() void SocketImpl::setSendTimeout(const Poco::Timespan& timeout) { -#if defined(_WIN32) +#if defined(_WIN32) int value = (int) timeout.totalMilliseconds(); setOption(SOL_SOCKET, SO_SNDTIMEO, value); -#else +#else setOption(SOL_SOCKET, SO_SNDTIMEO, timeout); #endif - _sndTimeout = timeout; + _sndTimeout = timeout; } @@ -650,7 +650,7 @@ void SocketImpl::setReceiveTimeout(const Poco::Timespan& timeout) #else setOption(SOL_SOCKET, SO_RCVTIMEO, timeout); #endif - _recvTimeout = timeout; + _recvTimeout = timeout; } diff --git a/contrib/libs/poco/NetSSL_OpenSSL/include/Poco/Net/SecureSocketImpl.h b/contrib/libs/poco/NetSSL_OpenSSL/include/Poco/Net/SecureSocketImpl.h index 9355b1b813..8d331a3a6d 100644 --- a/contrib/libs/poco/NetSSL_OpenSSL/include/Poco/Net/SecureSocketImpl.h +++ b/contrib/libs/poco/NetSSL_OpenSSL/include/Poco/Net/SecureSocketImpl.h @@ -195,7 +195,7 @@ protected: /// Returns true iff the given host name is the local host /// (either "localhost" or "127.0.0.1"). - bool mustRetry(int rc, Poco::Timespan& remaining_time); + bool mustRetry(int rc, Poco::Timespan& remaining_time); /// Returns true if the last operation should be retried, /// otherwise false. /// @@ -221,8 +221,8 @@ protected: /// Note that simply closing a socket is not sufficient /// to be able to re-use it again. - Poco::Timespan getMaxTimeout(); - + Poco::Timespan getMaxTimeout(); + private: SecureSocketImpl(const SecureSocketImpl&); SecureSocketImpl& operator = (const SecureSocketImpl&); diff --git a/contrib/libs/poco/NetSSL_OpenSSL/include/Poco/Net/SecureStreamSocketImpl.h b/contrib/libs/poco/NetSSL_OpenSSL/include/Poco/Net/SecureStreamSocketImpl.h index ec852b3cb3..3b000b4758 100644 --- a/contrib/libs/poco/NetSSL_OpenSSL/include/Poco/Net/SecureStreamSocketImpl.h +++ b/contrib/libs/poco/NetSSL_OpenSSL/include/Poco/Net/SecureStreamSocketImpl.h @@ -39,9 +39,9 @@ public: SecureStreamSocketImpl(StreamSocketImpl* pStreamSocket, Context::Ptr pContext); /// Creates the SecureStreamSocketImpl. - void setSendTimeout(const Poco::Timespan& timeout); - void setReceiveTimeout(const Poco::Timespan& timeout); - + void setSendTimeout(const Poco::Timespan& timeout); + void setReceiveTimeout(const Poco::Timespan& timeout); + SocketImpl* acceptConnection(SocketAddress& clientAddr); /// Not supported by a SecureStreamSocket. /// @@ -219,7 +219,7 @@ private: SecureStreamSocketImpl(const SecureStreamSocketImpl&); SecureStreamSocketImpl& operator = (const SecureStreamSocketImpl&); - StreamSocketImpl * underlying_socket; + StreamSocketImpl * underlying_socket; SecureSocketImpl _impl; bool _lazyHandshake; diff --git a/contrib/libs/poco/NetSSL_OpenSSL/src/SecureSocketImpl.cpp b/contrib/libs/poco/NetSSL_OpenSSL/src/SecureSocketImpl.cpp index c6fe6c8a9a..ef924d66ac 100644 --- a/contrib/libs/poco/NetSSL_OpenSSL/src/SecureSocketImpl.cpp +++ b/contrib/libs/poco/NetSSL_OpenSSL/src/SecureSocketImpl.cpp @@ -44,22 +44,22 @@ using Poco::Timespan; namespace Poco { namespace Net { -struct RemainingTimeCounter -{ - RemainingTimeCounter(Poco::Timespan& remainingTime_) : remainingTime(remainingTime_) {}; - ~RemainingTimeCounter() - { - Poco::Timestamp end; - Poco::Timespan waited = end - start; - if (waited < remainingTime) - remainingTime -= waited; - else - remainingTime = 0; - } -private: - Poco::Timespan& remainingTime; - Poco::Timestamp start; -}; +struct RemainingTimeCounter +{ + RemainingTimeCounter(Poco::Timespan& remainingTime_) : remainingTime(remainingTime_) {}; + ~RemainingTimeCounter() + { + Poco::Timestamp end; + Poco::Timespan waited = end - start; + if (waited < remainingTime) + remainingTime -= waited; + else + remainingTime = 0; + } +private: + Poco::Timespan& remainingTime; + Poco::Timestamp start; +}; SecureSocketImpl::SecureSocketImpl(Poco::AutoPtr<SocketImpl> pSocketImpl, Context::Ptr pContext): _pSSL(0), @@ -135,8 +135,8 @@ void SecureSocketImpl::connect(const SocketAddress& address, const Poco::Timespa poco_assert (!_pSSL); _pSocket->connect(address, timeout); - //FIXME it updates timeouts of SecureStreamSocketImpl::underlying_socket it does not update timeouts of SecureStreamSocketImpl - //However, timeouts of SecureStreamSocketImpl are not used in connectSSL() and previous settings are restored after + //FIXME it updates timeouts of SecureStreamSocketImpl::underlying_socket it does not update timeouts of SecureStreamSocketImpl + //However, timeouts of SecureStreamSocketImpl are not used in connectSSL() and previous settings are restored after Poco::Timespan receiveTimeout = _pSocket->getReceiveTimeout(); Poco::Timespan sendTimeout = _pSocket->getSendTimeout(); _pSocket->setReceiveTimeout(timeout); @@ -191,14 +191,14 @@ void SecureSocketImpl::connectSSL(bool performHandshake) { if (performHandshake && _pSocket->getBlocking()) { - int ret; - Poco::Timespan remaining_time = getMaxTimeout(); - do - { - RemainingTimeCounter counter(remaining_time); - ret = SSL_connect(_pSSL); - } - while (mustRetry(ret, remaining_time)); + int ret; + Poco::Timespan remaining_time = getMaxTimeout(); + do + { + RemainingTimeCounter counter(remaining_time); + ret = SSL_connect(_pSSL); + } + while (mustRetry(ret, remaining_time)); handleError(ret); verifyPeerCertificate(); } @@ -289,14 +289,14 @@ int SecureSocketImpl::sendBytes(const void* buffer, int length, int /*flags*/) else return rc; } - - Poco::Timespan remaining_time = getMaxTimeout(); + + Poco::Timespan remaining_time = getMaxTimeout(); do { - RemainingTimeCounter counter(remaining_time); + RemainingTimeCounter counter(remaining_time); rc = SSL_write(_pSSL, buffer, length); } - while (mustRetry(rc, remaining_time)); + while (mustRetry(rc, remaining_time)); if (rc <= 0) { rc = handleError(rc); @@ -320,17 +320,17 @@ int SecureSocketImpl::receiveBytes(void* buffer, int length, int /*flags*/) else return rc; } - - Poco::Timespan remaining_time = getMaxTimeout(); + + Poco::Timespan remaining_time = getMaxTimeout(); do { - /// SSL record may consist of several TCP packets, - /// so thread can be blocked on recv/send and epoll_wait several times - /// until SSL_read will return rc > 0. Let's use our own time counter. - RemainingTimeCounter counter(remaining_time); + /// SSL record may consist of several TCP packets, + /// so thread can be blocked on recv/send and epoll_wait several times + /// until SSL_read will return rc > 0. Let's use our own time counter. + RemainingTimeCounter counter(remaining_time); rc = SSL_read(_pSSL, buffer, length); } - while (mustRetry(rc, remaining_time)); + while (mustRetry(rc, remaining_time)); if (rc <= 0) { return handleError(rc); @@ -353,13 +353,13 @@ int SecureSocketImpl::completeHandshake() poco_check_ptr (_pSSL); int rc; - Poco::Timespan remaining_time = getMaxTimeout(); + Poco::Timespan remaining_time = getMaxTimeout(); do { - RemainingTimeCounter counter(remaining_time); + RemainingTimeCounter counter(remaining_time); rc = SSL_do_handshake(_pSSL); } - while (mustRetry(rc, remaining_time)); + while (mustRetry(rc, remaining_time)); if (rc <= 0) { return handleError(rc); @@ -430,16 +430,16 @@ X509* SecureSocketImpl::peerCertificate() const return 0; } -Poco::Timespan SecureSocketImpl::getMaxTimeout() -{ - Poco::Timespan remaining_time = _pSocket->getReceiveTimeout(); - Poco::Timespan send_timeout = _pSocket->getSendTimeout(); - if (remaining_time < send_timeout) - remaining_time = send_timeout; - return remaining_time; -} +Poco::Timespan SecureSocketImpl::getMaxTimeout() +{ + Poco::Timespan remaining_time = _pSocket->getReceiveTimeout(); + Poco::Timespan send_timeout = _pSocket->getSendTimeout(); + if (remaining_time < send_timeout) + remaining_time = send_timeout; + return remaining_time; +} -bool SecureSocketImpl::mustRetry(int rc, Poco::Timespan& remaining_time) +bool SecureSocketImpl::mustRetry(int rc, Poco::Timespan& remaining_time) { if (rc <= 0) { @@ -450,9 +450,9 @@ bool SecureSocketImpl::mustRetry(int rc, Poco::Timespan& remaining_time) case SSL_ERROR_WANT_READ: if (_pSocket->getBlocking()) { - /// Level-triggered mode of epoll_wait is used, so if SSL_read don't read all available data from socket, - /// epoll_wait returns true without waiting for new data even if remaining_time == 0 - if (_pSocket->pollImpl(remaining_time, Poco::Net::Socket::SELECT_READ) && remaining_time != 0) + /// Level-triggered mode of epoll_wait is used, so if SSL_read don't read all available data from socket, + /// epoll_wait returns true without waiting for new data even if remaining_time == 0 + if (_pSocket->pollImpl(remaining_time, Poco::Net::Socket::SELECT_READ) && remaining_time != 0) return true; else throw Poco::TimeoutException(); @@ -461,8 +461,8 @@ bool SecureSocketImpl::mustRetry(int rc, Poco::Timespan& remaining_time) case SSL_ERROR_WANT_WRITE: if (_pSocket->getBlocking()) { - /// The same as for SSL_ERROR_WANT_READ - if (_pSocket->pollImpl(remaining_time, Poco::Net::Socket::SELECT_WRITE) && remaining_time != 0) + /// The same as for SSL_ERROR_WANT_READ + if (_pSocket->pollImpl(remaining_time, Poco::Net::Socket::SELECT_WRITE) && remaining_time != 0) return true; else throw Poco::TimeoutException(); diff --git a/contrib/libs/poco/NetSSL_OpenSSL/src/SecureStreamSocketImpl.cpp b/contrib/libs/poco/NetSSL_OpenSSL/src/SecureStreamSocketImpl.cpp index 04b4caf350..bef198ae69 100644 --- a/contrib/libs/poco/NetSSL_OpenSSL/src/SecureStreamSocketImpl.cpp +++ b/contrib/libs/poco/NetSSL_OpenSSL/src/SecureStreamSocketImpl.cpp @@ -22,16 +22,16 @@ namespace Net { SecureStreamSocketImpl::SecureStreamSocketImpl(Context::Ptr pContext): - underlying_socket(new StreamSocketImpl), - _impl(underlying_socket, pContext), + underlying_socket(new StreamSocketImpl), + _impl(underlying_socket, pContext), _lazyHandshake(false) { } SecureStreamSocketImpl::SecureStreamSocketImpl(StreamSocketImpl* pStreamSocket, Context::Ptr pContext): - underlying_socket(pStreamSocket), - _impl(underlying_socket, pContext), + underlying_socket(pStreamSocket), + _impl(underlying_socket, pContext), _lazyHandshake(false) { pStreamSocket->duplicate(); @@ -51,18 +51,18 @@ SecureStreamSocketImpl::~SecureStreamSocketImpl() } } -void SecureStreamSocketImpl::setSendTimeout(const Poco::Timespan& timeout) -{ - underlying_socket->setSendTimeout(timeout); - _sndTimeout = underlying_socket->getSendTimeout(); -} +void SecureStreamSocketImpl::setSendTimeout(const Poco::Timespan& timeout) +{ + underlying_socket->setSendTimeout(timeout); + _sndTimeout = underlying_socket->getSendTimeout(); +} + +void SecureStreamSocketImpl::setReceiveTimeout(const Poco::Timespan& timeout) +{ + underlying_socket->setReceiveTimeout(timeout); + _recvTimeout = underlying_socket->getReceiveTimeout(); +} -void SecureStreamSocketImpl::setReceiveTimeout(const Poco::Timespan& timeout) -{ - underlying_socket->setReceiveTimeout(timeout); - _recvTimeout = underlying_socket->getReceiveTimeout(); -} - SocketImpl* SecureStreamSocketImpl::acceptConnection(SocketAddress& /*clientAddr*/) { throw Poco::InvalidAccessException("Cannot acceptConnection() on a SecureStreamSocketImpl"); |