[Libreoffice-commits] online.git: Branch 'private/Ashod/nonblocking' - net/clientnb.cpp net/socket.hpp
Ashod Nakashian
ashod.nakashian at collabora.co.uk
Sat Feb 18 21:16:47 UTC 2017
net/clientnb.cpp | 7 ++++---
net/socket.hpp | 20 ++++++--------------
2 files changed, 10 insertions(+), 17 deletions(-)
New commits:
commit 7c17d4b0d66e6a6ebdce3dab86cf9b3cc568461b
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date: Sat Feb 18 13:01:43 2017 -0500
nb: cosmetics
Change-Id: I3a9f95c0b8edacff69b3c3733e833e3a82c545a9
Reviewed-on: https://gerrit.libreoffice.org/34410
Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
Tested-by: Ashod Nakashian <ashnakash at gmail.com>
diff --git a/net/clientnb.cpp b/net/clientnb.cpp
index 40ddc2f..9877d66 100644
--- a/net/clientnb.cpp
+++ b/net/clientnb.cpp
@@ -188,6 +188,7 @@ struct Client : public Poco::Util::Application
void testWebsocket()
{
+ std::cerr << "testwebsocket\n";
Session session("ws", EnableHttps);
std::shared_ptr<WebSocket> ws = session.getWebSocket();
@@ -218,9 +219,9 @@ public:
// Just accept the certificate anyway for testing purposes
Poco::SharedPtr<Poco::Net::InvalidCertificateHandler> invalidCertHandler = new Poco::Net::AcceptCertificateHandler(false);
- Poco::Net::Context::Params sslParams;
- Poco::Net::Context::Ptr sslContext = new Poco::Net::Context(Poco::Net::Context::CLIENT_USE, sslParams);
- Poco::Net::SSLManager::instance().initializeClient(nullptr, invalidCertHandler, sslContext);
+ Poco::Net::Context::Params sslParams;
+ Poco::Net::Context::Ptr sslContext = new Poco::Net::Context(Poco::Net::Context::CLIENT_USE, sslParams);
+ Poco::Net::SSLManager::instance().initializeClient(nullptr, invalidCertHandler, sslContext);
}
testWebsocket();
diff --git a/net/socket.hpp b/net/socket.hpp
index 3f43793..0eec7f0 100644
--- a/net/socket.hpp
+++ b/net/socket.hpp
@@ -47,10 +47,9 @@ public:
virtual int getPollEvents() = 0;
/// Handle results of events returned from poll
- enum HandleResult { CONTINUE, SOCKET_CLOSED };
+ enum class HandleResult { CONTINUE, SOCKET_CLOSED };
virtual HandleResult handlePoll( int events ) = 0;
-
/// manage latency issues around packet aggregation
void setNoDelay(bool noDelay = true)
{
@@ -294,12 +293,7 @@ private:
class BufferingSocket : public Socket
{
public:
- BufferingSocket() :
- Socket()
- {
- }
-
- HandleResult handlePoll( int events ) override
+ HandleResult handlePoll(const int events) override
{
bool closeSocket = false;
@@ -325,10 +319,8 @@ public:
int getPollEvents() override
{
- int pollFor = POLLIN;
- if (_outBuffer.size() > 0)
- pollFor |= POLLOUT;
- return pollFor;
+ // Only poll for read we if we have nothing to write.
+ return (_outBuffer.empty() ? POLLIN : POLLIN | POLLOUT);
}
/// Override to handle read data.
@@ -392,7 +384,7 @@ protected:
template<class T> friend class ServerSocket;
};
-/// A SSL/TSL, non-blocking, data streaming socket.
+/// An SSL/TSL, non-blocking, data streaming socket.
class SslStreamSocket : public BufferingSocket
{
public:
@@ -581,7 +573,7 @@ private:
return rc;
}
- // fallthrough
+ // Fallthrough...
default:
{
// The error is comming from BIO. Find out what happened.
More information about the Libreoffice-commits
mailing list