Skip to content

Commit 7763937

Browse files
author
Sebastiano Merlino
committed
Boolean return code on resource registration
1 parent 5029c87 commit 7763937

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/httpserver/webserver.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ class webserver
261261
static void* select(void* self);
262262
static void* cleaner(void* self);
263263

264-
void register_resource(const std::string& resource,
264+
bool register_resource(const std::string& resource,
265265
details::http_resource_mirror hrm, bool family = false
266266
);
267267

src/webserver.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ void webserver::request_completed (
238238
}
239239
}
240240

241-
void webserver::register_resource(
241+
bool webserver::register_resource(
242242
const std::string& resource,
243243
details::http_resource_mirror hrm,
244244
bool family
@@ -250,7 +250,7 @@ void webserver::register_resource(
250250
details::http_endpoint idx(resource, family, true, regex_checking);
251251

252252
pair<map<details::http_endpoint, details::http_resource_mirror>::iterator, bool> result = registered_resources.insert(
253-
pair<details::http_endpoint, details::http_resource_mirror>(idx,hrm)
253+
pair<details::http_endpoint, details::http_resource_mirror>(idx, hrm)
254254
);
255255

256256
if(result.second)
@@ -259,6 +259,8 @@ void webserver::register_resource(
259259
pair<string, details::http_resource_mirror*>(idx.get_url_complete(), &(result.first->second))
260260
);
261261
}
262+
263+
return result.second;
262264
}
263265

264266
void* webserver::select(void* self)

0 commit comments

Comments
 (0)