Skip to content

Commit b6e22b9

Browse files
committed
Improve async_pam_auth
1 parent 88f8ea8 commit b6e22b9

1 file changed

Lines changed: 3 additions & 14 deletions

File tree

proxy/include/proxy/proxy_server.hpp

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -958,27 +958,16 @@ R"x*x*x(<html>
958958
std::thread([this, username = std::move(username), passwd = std::move(passwd),
959959
service_name = std::move(service_name), handler = std::move(handler)]() mutable
960960
{
961-
auto slot = net::get_associated_cancellation_slot(handler);
962-
auto executor = net::get_associated_executor(handler);
963-
std::atomic_bool cancelled = false;
964-
965-
if (slot.is_connected())
966-
{
967-
slot.assign([&cancelled](net::cancellation_type_t) mutable
968-
{
969-
cancelled = true;
970-
});
971-
}
972-
973-
boost::system::error_code ec;
974961
bool result = pam_authenticate_user(
975962
service_name.c_str(),
976963
username.c_str(),
977964
passwd.c_str());
978965

966+
auto executor = net::get_associated_executor(handler);
979967
net::post(executor,
980-
[ec = std::move(ec), result, handler = std::move(handler)]() mutable
968+
[result, handler = std::move(handler)]() mutable
981969
{
970+
boost::system::error_code ec;
982971
handler(ec, result);
983972
});
984973
}

0 commit comments

Comments
 (0)