|
|
@@ -29,12 +29,7 @@ cgrpc_channel *cgrpc_channel_create(const char *address) {
|
|
|
grpc_channel_args channel_args;
|
|
|
channel_args.num_args = 0;
|
|
|
c->channel = grpc_insecure_channel_create(address, &channel_args, NULL);
|
|
|
- grpc_completion_queue_attributes attr;
|
|
|
- attr.version = 1;
|
|
|
- attr.cq_completion_type = GRPC_CQ_CURRENT_VERSION;
|
|
|
- attr.cq_polling_type = GRPC_CQ_DEFAULT_POLLING;
|
|
|
- grpc_completion_queue_factory *factory = grpc_completion_queue_factory_lookup(&attr);
|
|
|
- c->completion_queue = grpc_completion_queue_create(factory, &attr, NULL);
|
|
|
+ c->completion_queue = grpc_completion_queue_create_for_next(NULL);
|
|
|
return c;
|
|
|
}
|
|
|
|
|
|
@@ -66,12 +61,7 @@ cgrpc_channel *cgrpc_channel_create_secure(const char *address,
|
|
|
|
|
|
grpc_channel_credentials *creds = grpc_ssl_credentials_create(pem_root_certs, NULL, NULL);
|
|
|
c->channel = grpc_secure_channel_create(creds, address, channelArgs, NULL);
|
|
|
- grpc_completion_queue_attributes attr;
|
|
|
- attr.version = 1;
|
|
|
- attr.cq_completion_type = GRPC_CQ_CURRENT_VERSION;
|
|
|
- attr.cq_polling_type = GRPC_CQ_DEFAULT_POLLING;
|
|
|
- grpc_completion_queue_factory *factory = grpc_completion_queue_factory_lookup(&attr);
|
|
|
- c->completion_queue = grpc_completion_queue_create(factory, &attr, NULL);
|
|
|
+ c->completion_queue = grpc_completion_queue_create_for_next(NULL);
|
|
|
return c;
|
|
|
}
|
|
|
|
|
|
@@ -86,19 +76,21 @@ void cgrpc_channel_destroy(cgrpc_channel *c) {
|
|
|
free(c);
|
|
|
}
|
|
|
|
|
|
+grpc_slice host_slice;
|
|
|
+
|
|
|
cgrpc_call *cgrpc_channel_create_call(cgrpc_channel *channel,
|
|
|
const char *method,
|
|
|
const char *host,
|
|
|
double timeout) {
|
|
|
// create call
|
|
|
- grpc_slice host_slice = grpc_slice_from_copied_string(host);
|
|
|
+ host_slice = grpc_slice_from_copied_string(host);
|
|
|
gpr_timespec deadline = cgrpc_deadline_in_seconds_from_now(timeout);
|
|
|
grpc_call *channel_call = grpc_channel_create_call(channel->channel,
|
|
|
NULL,
|
|
|
GRPC_PROPAGATE_DEFAULTS,
|
|
|
channel->completion_queue,
|
|
|
grpc_slice_from_copied_string(method),
|
|
|
- &host_slice, // this might crash
|
|
|
+ &host_slice,
|
|
|
deadline,
|
|
|
NULL);
|
|
|
cgrpc_call *call = (cgrpc_call *) malloc(sizeof(cgrpc_call));
|