diff --git a/include/grpc/grpc.h b/include/grpc/grpc.h index bcf64a6081a5eaad193f191e95c3d8ea76e26db7..fa4fd6d49d06f2e11f39eee84d3881a2bbaafdeb 100644 --- a/include/grpc/grpc.h +++ b/include/grpc/grpc.h @@ -128,10 +128,12 @@ typedef enum { GRPC_CQ_NON_POLLING } grpc_cq_polling_type; + +#define GRPC_CQ_CURRENT_VERSION 1 typedef struct grpc_completion_queue_attributes { /* The version number of this structure. More fields might be added to this structure in future. */ - int version; /* Current version is 1 */ + int version; /* Set to GRPC_CQ_CURRENT_VERSION */ grpc_cq_completion_type cq_type; diff --git a/src/core/lib/surface/completion_queue_factory.c b/src/core/lib/surface/completion_queue_factory.c index 879b456ed5dd92986428e2b43412b9152d5194c5..138dfeff4849607653f2c3426761d354493c97b7 100644 --- a/src/core/lib/surface/completion_queue_factory.c +++ b/src/core/lib/surface/completion_queue_factory.c @@ -52,7 +52,9 @@ static const grpc_completion_queue_factory g_default_cq_factory = { const grpc_completion_queue_factory* grpc_completion_queue_factory_lookup( const grpc_completion_queue_attributes* attributes) { /* As we add more fields to grpc_completion_queue_attributes, we may have to - change this assert */ + change this assert to: + GPR_ASSERT (attributes->version >= 1 && + attributes->version <= GRPC_CQ_CURRENT_VERSION) */ GPR_ASSERT(attributes->version == 1); /* The default factory can handle version 1 of the attributes structure. We