net/clientnb.cpp | 16 ++++++++++------ net/socket.hpp | 2 +- 2 files changed, 11 insertions(+), 7 deletions(-)
New commits: commit 88b3c174ef800d435550495e44952d285f4e9f49 Author: Ashod Nakashian <[email protected]> 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 <[email protected]> Tested-by: Ashod Nakashian <[email protected]> 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. } _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
