[Libreoffice-commits] online.git: kit/ForKit.cpp
Ashod Nakashian
ashod.nakashian at collabora.co.uk
Mon May 8 02:52:42 UTC 2017
kit/ForKit.cpp | 30 +++++++++++++++++-------------
1 file changed, 17 insertions(+), 13 deletions(-)
New commits:
commit f062b2058ea97be06a40b9a159ad4de58c7a2dc9
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date: Sat May 6 22:13:02 2017 -0400
wsd: use fast tokenizer
Change-Id: I477bac24a5e944ce3d747db6e694f2766b44c7f3
Reviewed-on: https://gerrit.libreoffice.org/37370
Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
Tested-by: Ashod Nakashian <ashnakash at gmail.com>
diff --git a/kit/ForKit.cpp b/kit/ForKit.cpp
index 035f69a9..64d17f45 100644
--- a/kit/ForKit.cpp
+++ b/kit/ForKit.cpp
@@ -26,7 +26,6 @@
#include <Poco/Path.h>
#include <Poco/Process.h>
-#include <Poco/StringTokenizer.h>
#include <Poco/Thread.h>
#include <Poco/Util/Application.h>
@@ -42,7 +41,6 @@
#include "security.h"
using Poco::Process;
-using Poco::StringTokenizer;
using Poco::Thread;
#ifndef KIT_IN_PROCESS
using Poco::Util::Application;
@@ -96,21 +94,27 @@ public:
}
LOG_INF("ForKit command: [" << message << "].");
- StringTokenizer tokens(message, " ", StringTokenizer::TOK_IGNORE_EMPTY | StringTokenizer::TOK_TRIM);
-
- if (tokens[0] == "spawn" && tokens.count() == 2)
+ try
{
- const auto count = std::stoi(tokens[1]);
- if (count > 0)
- {
- LOG_INF("Setting to spawn " << tokens[1] << " child" << (count == 1 ? "" : "ren") << " per request.");
- ForkCounter = count;
- }
- else
+ std::vector<std::string> tokens = LOOLProtocol::tokenize(message);
+ if (tokens.size() == 2 && tokens[0] == "spawn")
{
- LOG_WRN("Cannot spawn " << tokens[1] << " children as requested.");
+ const auto count = std::stoi(tokens[1]);
+ if (count > 0)
+ {
+ LOG_INF("Setting to spawn " << tokens[1] << " child" << (count == 1 ? "" : "ren") << " per request.");
+ ForkCounter = count;
+ }
+ else
+ {
+ LOG_WRN("Cannot spawn " << tokens[1] << " children as requested.");
+ }
}
}
+ catch (const std::exception& exc)
+ {
+ LOG_ERR("Error while processing forkit request [" << message << "]: " << exc.what());
+ }
return true;
}
More information about the Libreoffice-commits
mailing list