@@ -29,12 +29,7 @@ cgrpc_channel *cgrpc_channel_create(const char *address) {
2929 grpc_channel_args channel_args ;
3030 channel_args .num_args = 0 ;
3131 c -> channel = grpc_insecure_channel_create (address , & channel_args , NULL );
32- grpc_completion_queue_attributes attr ;
33- attr .version = 1 ;
34- attr .cq_completion_type = GRPC_CQ_CURRENT_VERSION ;
35- attr .cq_polling_type = GRPC_CQ_DEFAULT_POLLING ;
36- grpc_completion_queue_factory * factory = grpc_completion_queue_factory_lookup (& attr );
37- c -> completion_queue = grpc_completion_queue_create (factory , & attr , NULL );
32+ c -> completion_queue = grpc_completion_queue_create_for_next (NULL );
3833 return c ;
3934}
4035
@@ -66,12 +61,7 @@ cgrpc_channel *cgrpc_channel_create_secure(const char *address,
6661
6762 grpc_channel_credentials * creds = grpc_ssl_credentials_create (pem_root_certs , NULL , NULL );
6863 c -> channel = grpc_secure_channel_create (creds , address , channelArgs , NULL );
69- grpc_completion_queue_attributes attr ;
70- attr .version = 1 ;
71- attr .cq_completion_type = GRPC_CQ_CURRENT_VERSION ;
72- attr .cq_polling_type = GRPC_CQ_DEFAULT_POLLING ;
73- grpc_completion_queue_factory * factory = grpc_completion_queue_factory_lookup (& attr );
74- c -> completion_queue = grpc_completion_queue_create (factory , & attr , NULL );
64+ c -> completion_queue = grpc_completion_queue_create_for_next (NULL );
7565 return c ;
7666}
7767
@@ -86,19 +76,21 @@ void cgrpc_channel_destroy(cgrpc_channel *c) {
8676 free (c );
8777}
8878
79+ grpc_slice host_slice ;
80+
8981cgrpc_call * cgrpc_channel_create_call (cgrpc_channel * channel ,
9082 const char * method ,
9183 const char * host ,
9284 double timeout ) {
9385 // create call
94- grpc_slice host_slice = grpc_slice_from_copied_string (host );
86+ host_slice = grpc_slice_from_copied_string (host );
9587 gpr_timespec deadline = cgrpc_deadline_in_seconds_from_now (timeout );
9688 grpc_call * channel_call = grpc_channel_create_call (channel -> channel ,
9789 NULL ,
9890 GRPC_PROPAGATE_DEFAULTS ,
9991 channel -> completion_queue ,
10092 grpc_slice_from_copied_string (method ),
101- & host_slice , // this might crash
93+ & host_slice ,
10294 deadline ,
10395 NULL );
10496 cgrpc_call * call = (cgrpc_call * ) malloc (sizeof (cgrpc_call ));
0 commit comments