[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 00:44:50 UTC 2017


 net/clientnb.cpp |   16 ++++++++++------
 net/socket.hpp   |    2 +-
 2 files changed, 11 insertions(+), 7 deletions(-)

New commits:
commit 88b3c174ef800d435550495e44952d285f4e9f49
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Fri Feb 17 18:55:10 2017 -0500

    nb: support SSL in clientnb
    
    Change-Id: Ia895558c7115a39824474ba7acff060102192c10
    Reviewed-on: https://gerrit.libreoffice.org/34394
    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 2ab1980..96fdc80 100644
--- a/net/clientnb.cpp
+++ b/net/clientnb.cpp
@@ -50,7 +50,8 @@ using Poco::Util::Option;
 using Poco::Util::OptionSet;
 
 const char *HostName = "127.0.0.1";
-constexpr int PortNumber = 9191;
+constexpr int HttpPortNumber = 9191;
+constexpr int SslPortNumber = 9193;
 
 struct Session
 {
@@ -61,9 +62,9 @@ struct Session
         : _session_name(session_name)
     {
         if (https)
-            _session = new Poco::Net::HTTPSClientSession(HostName, PortNumber);
+            _session = new Poco::Net::HTTPSClientSession(HostName, SslPortNumber);
         else
-            _session = new Poco::Net::HTTPClientSession(HostName, PortNumber);
+            _session = new Poco::Net::HTTPClientSession(HostName, HttpPortNumber);
     }
     ~Session()
     {
@@ -178,14 +179,17 @@ struct Client : public Poco::Util::Application
     }
 
 public:
-    int main(const std::vector<std::string>& /* args */) override
+    int main(const std::vector<std::string>& args) override
     {
+        const bool https = (args.size() > 0 && args[0] == "ssl");
+        std::cerr << "Starting " << (https ? "HTTPS" : "HTTP") << " client." << std::endl;
+
         if (getenv("WS"))
             testWebsocket();
         else
         {
-            Session first("init");
-            Session second("init");
+            Session first("init", https);
+            Session second("init", https);
 
             int count = 42, back;
             first.sendPing(count);
diff --git a/net/socket.hpp b/net/socket.hpp
index fae37a2..69d2710 100644
--- a/net/socket.hpp
+++ b/net/socket.hpp
@@ -184,7 +184,7 @@ public:
                 if (_pollSockets[i]->handlePoll(_pollFds[i].revents) ==
                     Socket::HandleResult::SOCKET_CLOSED)
                 {
-                    std::cout << "Removing: " << _pollFds[i].fd << std::endl;
+                    std::cout << "Removing client #" << _pollFds[i].fd << std::endl;
                     _pollSockets.erase(_pollSockets.begin() + i);
                     // Don't remove from pollFds; we'll recreate below.
                 }


More information about the Libreoffice-commits mailing list