Skip to content

Commit

Permalink
Single thread fake token fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
y-zeng committed Aug 18, 2016
1 parent df2a7b7 commit 6f8f09f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/core/lib/security/credentials/fake/fake_credentials.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,12 @@ static void md_only_test_get_request_metadata(
if (c->is_async) {
grpc_credentials_metadata_request *cb_arg =
grpc_credentials_metadata_request_create(creds, cb, user_data);
grpc_executor_push(
grpc_closure_create(on_simulated_token_fetch_done, cb_arg),
GRPC_ERROR_NONE);
grpc_timer_init(exec_ctx, &c->timer,
gpr_time_add(gpr_now(GPR_CLOCK_MONOTONIC),
gpr_time_from_micros(10, GPR_TIMESPAN)),
on_simulated_token_fetch_done, cb_arg,
gpr_now(GPR_CLOCK_MONOTONIC));

} else {
cb(exec_ctx, user_data, c->md_store->entries, 1, GRPC_CREDENTIALS_OK, NULL);
}
Expand Down
2 changes: 2 additions & 0 deletions src/core/lib/security/credentials/fake/fake_credentials.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#ifndef GRPC_CORE_LIB_SECURITY_CREDENTIALS_FAKE_FAKE_CREDENTIALS_H
#define GRPC_CORE_LIB_SECURITY_CREDENTIALS_FAKE_FAKE_CREDENTIALS_H

#include "src/core/lib/iomgr/timer.h"
#include "src/core/lib/security/credentials/credentials.h"

/* -- Fake transport security credentials. -- */
Expand All @@ -50,6 +51,7 @@ grpc_server_credentials *grpc_fake_transport_security_server_credentials_create(
typedef struct {
grpc_call_credentials base;
grpc_credentials_md_store *md_store;
grpc_timer timer;
int is_async;
} grpc_md_only_test_credentials;

Expand Down

0 comments on commit 6f8f09f

Please sign in to comment.