Skip to content

Commit 2db176f

Browse files
trondndaverigby
authored andcommitted
[Cleanup] Simplify ServerCookieApi::set_priority
The underlying function will throw an exception if an invalid priority is called so we don't need to run the checks twice Change-Id: I45cf1493a7a7450d37e5a87c480571829f65f0ff Reviewed-on: http://review.couchbase.org/c/kv_engine/+/141084 Tested-by: Build Bot <[email protected]> Reviewed-by: Dave Rigby <[email protected]>
1 parent 9d9d266 commit 2db176f

File tree

1 file changed

+2
-20
lines changed

1 file changed

+2
-20
lines changed

daemon/server_api.cc

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -246,27 +246,9 @@ struct ServerCookieApi : public ServerCookieIface {
246246
return ENGINE_SUCCESS;
247247
}
248248

249-
void set_priority(gsl::not_null<const void*> void_cookie,
249+
void set_priority(gsl::not_null<const void*> cookie,
250250
ConnectionPriority priority) override {
251-
auto* cookie = reinterpret_cast<const Cookie*>(void_cookie.get());
252-
253-
auto* c = &cookie->getConnection();
254-
switch (priority) {
255-
case ConnectionPriority::High:
256-
case ConnectionPriority::Medium:
257-
case ConnectionPriority::Low:
258-
c->setPriority(priority);
259-
return;
260-
}
261-
262-
LOG_WARNING(
263-
"{}: ServerCookieApi::set_priority: priority (which is {}) is "
264-
"not a "
265-
"valid CONN_PRIORITY - closing connection {}",
266-
c->getId(),
267-
int(priority),
268-
c->getDescription());
269-
c->shutdown();
251+
getCookie(cookie).getConnection().setPriority(priority);
270252
}
271253

272254
ConnectionPriority get_priority(

0 commit comments

Comments
 (0)