|
|
|
@ -36,15 +36,15 @@ |
|
|
|
|
|
|
|
|
|
namespace grpc { |
|
|
|
|
|
|
|
|
|
void AuthMetadataProcessorAyncWrapper::Destroy(void* wrapper) { |
|
|
|
|
auto* w = static_cast<AuthMetadataProcessorAyncWrapper*>(wrapper); |
|
|
|
|
void AuthMetadataProcessorAsyncWrapper::Destroy(void* wrapper) { |
|
|
|
|
auto* w = static_cast<AuthMetadataProcessorAsyncWrapper*>(wrapper); |
|
|
|
|
delete w; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void AuthMetadataProcessorAyncWrapper::Process( |
|
|
|
|
void AuthMetadataProcessorAsyncWrapper::Process( |
|
|
|
|
void* wrapper, grpc_auth_context* context, const grpc_metadata* md, |
|
|
|
|
size_t num_md, grpc_process_auth_metadata_done_cb cb, void* user_data) { |
|
|
|
|
auto* w = static_cast<AuthMetadataProcessorAyncWrapper*>(wrapper); |
|
|
|
|
auto* w = static_cast<AuthMetadataProcessorAsyncWrapper*>(wrapper); |
|
|
|
|
if (!w->processor_) { |
|
|
|
|
// Early exit.
|
|
|
|
|
cb(user_data, nullptr, 0, nullptr, 0, GRPC_STATUS_OK, nullptr); |
|
|
|
@ -52,8 +52,8 @@ void AuthMetadataProcessorAyncWrapper::Process( |
|
|
|
|
} |
|
|
|
|
if (w->processor_->IsBlocking()) { |
|
|
|
|
w->thread_pool_->Add([w, context, md, num_md, cb, user_data] { |
|
|
|
|
w->AuthMetadataProcessorAyncWrapper::InvokeProcessor(context, md, num_md, |
|
|
|
|
cb, user_data); |
|
|
|
|
w->AuthMetadataProcessorAsyncWrapper::InvokeProcessor(context, md, num_md, |
|
|
|
|
cb, user_data); |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
|
// invoke directly.
|
|
|
|
@ -61,7 +61,7 @@ void AuthMetadataProcessorAyncWrapper::Process( |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void AuthMetadataProcessorAyncWrapper::InvokeProcessor( |
|
|
|
|
void AuthMetadataProcessorAsyncWrapper::InvokeProcessor( |
|
|
|
|
grpc_auth_context* context, const grpc_metadata* md, size_t num_md, |
|
|
|
|
grpc_process_auth_metadata_done_cb cb, void* user_data) { |
|
|
|
|
AuthMetadataProcessor::InputMetadata metadata; |
|
|
|
@ -104,10 +104,10 @@ int SecureServerCredentials::AddPortToServer(const std::string& addr, |
|
|
|
|
|
|
|
|
|
void SecureServerCredentials::SetAuthMetadataProcessor( |
|
|
|
|
const std::shared_ptr<grpc::AuthMetadataProcessor>& processor) { |
|
|
|
|
auto* wrapper = new grpc::AuthMetadataProcessorAyncWrapper(processor); |
|
|
|
|
auto* wrapper = new grpc::AuthMetadataProcessorAsyncWrapper(processor); |
|
|
|
|
grpc_server_credentials_set_auth_metadata_processor( |
|
|
|
|
creds_, {grpc::AuthMetadataProcessorAyncWrapper::Process, |
|
|
|
|
grpc::AuthMetadataProcessorAyncWrapper::Destroy, wrapper}); |
|
|
|
|
creds_, {grpc::AuthMetadataProcessorAsyncWrapper::Process, |
|
|
|
|
grpc::AuthMetadataProcessorAsyncWrapper::Destroy, wrapper}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
std::shared_ptr<ServerCredentials> SslServerCredentials( |
|
|
|
|