Unverified Commit e623e353 authored by Igor [hyperxor]'s avatar Igor [hyperxor] Committed by GitHub

Several minor fixes in router code (#735)

* Code improvements in router

* Trigger CI
parent 97ab680b
......@@ -33,7 +33,7 @@ void handleReady(const Rest::Request&, Http::ResponseWriter response) {
class StatsEndpoint {
public:
StatsEndpoint(Address addr)
explicit StatsEndpoint(Address addr)
: httpEndpoint(std::make_shared<Http::Endpoint>(addr))
{ }
......@@ -112,7 +112,7 @@ private:
class Metric {
public:
Metric(std::string name, int initialValue = 1)
explicit Metric(std::string name, int initialValue = 1)
: name_(std::move(name))
, value_(initialValue)
{ }
......@@ -127,7 +127,7 @@ private:
return value_;
}
std::string name() const {
const std::string& name() const {
return name_;
}
private:
......@@ -135,8 +135,8 @@ private:
int value_;
};
typedef std::mutex Lock;
typedef std::lock_guard<Lock> Guard;
using Lock = std::mutex;
using Guard = std::lock_guard<Lock>;
Lock metricsLock;
std::vector<Metric> metrics;
......
......@@ -427,7 +427,7 @@ public:
std::string rawBasePath() const { return basePath_; }
std::vector<Scheme> rawSchemes() const { return schemes_; }
Schema::ProduceConsume rawPC() const { return pc; }
Schema::PathGroup rawPaths() const { return paths_; }
const Schema::PathGroup &rawPaths() const { return paths_; }
private:
Schema::Info info_;
......
......@@ -361,7 +361,7 @@ void Router::del(const std::string &resource, Route::Handler handler) {
}
void Router::options(const std::string &resource, Route::Handler handler) {
addRoute(Http::Method::Options, resource, handler);
addRoute(Http::Method::Options, resource, std::move(handler));
}
void Router::removeRoute(Http::Method method, const std::string &resource) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment