Beispiel #1
0
static void on_connected(void *arg, grpc_endpoint *tcp) {
  internal_request *req = arg;

  gpr_log(GPR_DEBUG, "%s", __FUNCTION__);
  if (!tcp) {
    next_address(req);
    return;
  }
  req->ep = tcp;
  if (req->use_ssl) {
    grpc_channel_security_context *ctx = NULL;
    const unsigned char *pem_root_certs = NULL;
    size_t pem_root_certs_size = grpc_get_default_ssl_roots(&pem_root_certs);
    if (pem_root_certs == NULL || pem_root_certs_size == 0) {
      gpr_log(GPR_ERROR, "Could not get default pem root certs.");
      finish(req, 0);
      return;
    }
    GPR_ASSERT(grpc_httpcli_ssl_channel_security_context_create(
                   pem_root_certs, pem_root_certs_size, req->host, &ctx) ==
               GRPC_SECURITY_OK);
    grpc_setup_secure_transport(&ctx->base, tcp, on_secure_transport_setup_done,
                                req);
    grpc_security_context_unref(&ctx->base);
  } else {
    start_write(req);
  }
}
static void connected(void *arg, grpc_endpoint *tcp) {
  connector *c = arg;
  grpc_iomgr_closure *notify;
  if (tcp != NULL) {
    grpc_setup_secure_transport(&c->security_connector->base, tcp,
                                on_secure_transport_setup_done, c);
  } else {
    memset(c->result, 0, sizeof(*c->result));
    notify = c->notify;
    c->notify = NULL;
    grpc_iomgr_add_callback(notify);
  }
}
Beispiel #3
0
static void on_accept(void *server, grpc_endpoint *tcp) {
  const grpc_channel_args *args = grpc_server_get_channel_args(server);
  grpc_security_context *ctx = grpc_find_security_context_in_args(args);
  GPR_ASSERT(ctx);
  grpc_setup_secure_transport(ctx, tcp, on_secure_transport_setup_done, server);
}
Beispiel #4
0
static void on_accept(void *statep, grpc_endpoint *tcp) {
  grpc_server_secure_state *state = statep;
  state_ref(state);
  grpc_setup_secure_transport(state->ctx, tcp, on_secure_transport_setup_done,
                              state);
}