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) { ...@@ -33,7 +33,7 @@ void handleReady(const Rest::Request&, Http::ResponseWriter response) {
class StatsEndpoint { class StatsEndpoint {
public: public:
StatsEndpoint(Address addr) explicit StatsEndpoint(Address addr)
: httpEndpoint(std::make_shared<Http::Endpoint>(addr)) : httpEndpoint(std::make_shared<Http::Endpoint>(addr))
{ } { }
...@@ -112,7 +112,7 @@ private: ...@@ -112,7 +112,7 @@ private:
class Metric { class Metric {
public: public:
Metric(std::string name, int initialValue = 1) explicit Metric(std::string name, int initialValue = 1)
: name_(std::move(name)) : name_(std::move(name))
, value_(initialValue) , value_(initialValue)
{ } { }
...@@ -127,7 +127,7 @@ private: ...@@ -127,7 +127,7 @@ private:
return value_; return value_;
} }
std::string name() const { const std::string& name() const {
return name_; return name_;
} }
private: private:
...@@ -135,8 +135,8 @@ private: ...@@ -135,8 +135,8 @@ private:
int value_; int value_;
}; };
typedef std::mutex Lock; using Lock = std::mutex;
typedef std::lock_guard<Lock> Guard; using Guard = std::lock_guard<Lock>;
Lock metricsLock; Lock metricsLock;
std::vector<Metric> metrics; std::vector<Metric> metrics;
......
...@@ -427,7 +427,7 @@ public: ...@@ -427,7 +427,7 @@ public:
std::string rawBasePath() const { return basePath_; } std::string rawBasePath() const { return basePath_; }
std::vector<Scheme> rawSchemes() const { return schemes_; } std::vector<Scheme> rawSchemes() const { return schemes_; }
Schema::ProduceConsume rawPC() const { return pc; } Schema::ProduceConsume rawPC() const { return pc; }
Schema::PathGroup rawPaths() const { return paths_; } const Schema::PathGroup &rawPaths() const { return paths_; }
private: private:
Schema::Info info_; Schema::Info info_;
......
...@@ -361,7 +361,7 @@ void Router::del(const std::string &resource, Route::Handler handler) { ...@@ -361,7 +361,7 @@ void Router::del(const std::string &resource, Route::Handler handler) {
} }
void Router::options(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) { 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