From fe5989ecf5da20eddab6bd4079a77b04e36b78b8 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Wed, 16 May 2018 13:36:21 -0700 Subject: [PATCH] Comments --- src/core/lib/iomgr/ev_epoll1_linux.cc | 2 +- src/core/lib/iomgr/ev_epollex_linux.cc | 2 +- src/core/lib/iomgr/ev_poll_posix.cc | 2 +- src/core/lib/iomgr/polling_entity.cc | 18 ++++++++++++------ src/core/lib/iomgr/tcp_posix.cc | 2 +- src/core/lib/iomgr/tcp_server_posix.cc | 2 +- .../lib/iomgr/tcp_server_utils_posix_common.cc | 2 +- src/core/lib/transport/transport.cc | 6 +++++- .../GRPCClient/private/GRPCCompletionQueue.m | 1 - 9 files changed, 23 insertions(+), 14 deletions(-) diff --git a/src/core/lib/iomgr/ev_epoll1_linux.cc b/src/core/lib/iomgr/ev_epoll1_linux.cc index 4b4c954d27c..3573a121e22 100644 --- a/src/core/lib/iomgr/ev_epoll1_linux.cc +++ b/src/core/lib/iomgr/ev_epoll1_linux.cc @@ -1244,5 +1244,5 @@ const grpc_event_engine_vtable* grpc_init_epoll1_linux(bool explicit_request) { const grpc_event_engine_vtable* grpc_init_epoll1_linux(bool explicit_request) { return nullptr; } -#endif /* defined(GRPC_POSIX_SOCKET) */ +#endif /* defined(GRPC_POSIX_SOCKET_EV_EPOLL1) */ #endif /* !defined(GRPC_LINUX_EPOLL) */ diff --git a/src/core/lib/iomgr/ev_epollex_linux.cc b/src/core/lib/iomgr/ev_epollex_linux.cc index 1cb9105ed91..efa31b92060 100644 --- a/src/core/lib/iomgr/ev_epollex_linux.cc +++ b/src/core/lib/iomgr/ev_epollex_linux.cc @@ -1508,6 +1508,6 @@ const grpc_event_engine_vtable* grpc_init_epollex_linux( bool explicitly_requested) { return nullptr; } -#endif /* defined(GRPC_POSIX_SOCKET) */ +#endif /* defined(GRPC_POSIX_SOCKET_EV_EPOLLEX) */ #endif /* !defined(GRPC_LINUX_EPOLL_CREATE1) */ diff --git a/src/core/lib/iomgr/ev_poll_posix.cc b/src/core/lib/iomgr/ev_poll_posix.cc index 1c1da3b38af..a3a079bbe32 100644 --- a/src/core/lib/iomgr/ev_poll_posix.cc +++ b/src/core/lib/iomgr/ev_poll_posix.cc @@ -1761,4 +1761,4 @@ const grpc_event_engine_vtable* grpc_init_poll_cv_posix(bool explicit_request) { return &vtable; } -#endif +#endif /* GRPC_POSIX_SOCKET_EV_POLL */ diff --git a/src/core/lib/iomgr/polling_entity.cc b/src/core/lib/iomgr/polling_entity.cc index 651488d0f17..fa5628dbcff 100644 --- a/src/core/lib/iomgr/polling_entity.cc +++ b/src/core/lib/iomgr/polling_entity.cc @@ -61,9 +61,12 @@ bool grpc_polling_entity_is_empty(const grpc_polling_entity* pollent) { void grpc_polling_entity_add_to_pollset_set(grpc_polling_entity* pollent, grpc_pollset_set* pss_dst) { if (pollent->tag == GRPC_POLLS_POLLSET) { - if (pollent->pollent.pollset != nullptr) { - grpc_pollset_set_add_pollset(pss_dst, pollent->pollent.pollset); - } +#ifdef GRPC_CFSTREAM + GPR_ASSERT(pollent->pollent.pollset == nullptr); +#else + GPR_ASSERT(pollent->pollent.pollset != nullptr); + grpc_pollset_set_add_pollset(pss_dst, pollent->pollent.pollset); +#endif } else if (pollent->tag == GRPC_POLLS_POLLSET_SET) { GPR_ASSERT(pollent->pollent.pollset_set != nullptr); grpc_pollset_set_add_pollset_set(pss_dst, pollent->pollent.pollset_set); @@ -76,9 +79,12 @@ void grpc_polling_entity_add_to_pollset_set(grpc_polling_entity* pollent, void grpc_polling_entity_del_from_pollset_set(grpc_polling_entity* pollent, grpc_pollset_set* pss_dst) { if (pollent->tag == GRPC_POLLS_POLLSET) { - if (pollent->pollent.pollset != nullptr) { - grpc_pollset_set_del_pollset(pss_dst, pollent->pollent.pollset); - } +#ifdef GRPC_CFSTREAM + GPR_ASSERT(pollent->pollent.pollset == nullptr); +#else + GPR_ASSERT(pollent->pollent.pollset != nullptr); + grpc_pollset_set_del_pollset(pss_dst, pollent->pollent.pollset); +#endif } else if (pollent->tag == GRPC_POLLS_POLLSET_SET) { GPR_ASSERT(pollent->pollent.pollset_set != nullptr); grpc_pollset_set_del_pollset_set(pss_dst, pollent->pollent.pollset_set); diff --git a/src/core/lib/iomgr/tcp_posix.cc b/src/core/lib/iomgr/tcp_posix.cc index d7dda7454b8..6fdf9b93fe3 100644 --- a/src/core/lib/iomgr/tcp_posix.cc +++ b/src/core/lib/iomgr/tcp_posix.cc @@ -811,4 +811,4 @@ void grpc_tcp_destroy_and_release_fd(grpc_endpoint* ep, int* fd, TCP_UNREF(tcp, "destroy"); } -#endif +#endif /* GRPC_POSIX_SOCKET_TCP */ diff --git a/src/core/lib/iomgr/tcp_server_posix.cc b/src/core/lib/iomgr/tcp_server_posix.cc index 463eb6de958..7c338d54620 100644 --- a/src/core/lib/iomgr/tcp_server_posix.cc +++ b/src/core/lib/iomgr/tcp_server_posix.cc @@ -558,4 +558,4 @@ grpc_tcp_server_vtable grpc_posix_tcp_server_vtable = { tcp_server_shutdown_starting_add, tcp_server_unref, tcp_server_shutdown_listeners}; -#endif +#endif /* GRPC_POSIX_SOCKET_TCP_SERVER */ diff --git a/src/core/lib/iomgr/tcp_server_utils_posix_common.cc b/src/core/lib/iomgr/tcp_server_utils_posix_common.cc index 48afd926b41..3669d7b6878 100644 --- a/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +++ b/src/core/lib/iomgr/tcp_server_utils_posix_common.cc @@ -205,4 +205,4 @@ error: return ret; } -#endif /* GRPC_POSIX_SOCKET */ +#endif /* GRPC_POSIX_SOCKET_TCP_SERVER_UTILS_COMMON */ diff --git a/src/core/lib/transport/transport.cc b/src/core/lib/transport/transport.cc index d34affb0456..9b633efc578 100644 --- a/src/core/lib/transport/transport.cc +++ b/src/core/lib/transport/transport.cc @@ -184,7 +184,11 @@ void grpc_transport_set_pops(grpc_transport* transport, grpc_stream* stream, nullptr) { transport->vtable->set_pollset_set(transport, stream, pollset_set); } else { - // No-op for empty pollset +#ifdef GRPC_CFSTREAM + // No-op for empty pollset +#else + abort(); +#endif } } diff --git a/src/objective-c/GRPCClient/private/GRPCCompletionQueue.m b/src/objective-c/GRPCClient/private/GRPCCompletionQueue.m index 7d14a1c9786..bda1c3360be 100644 --- a/src/objective-c/GRPCClient/private/GRPCCompletionQueue.m +++ b/src/objective-c/GRPCClient/private/GRPCCompletionQueue.m @@ -43,7 +43,6 @@ const grpc_completion_queue_attributes kCompletionQueueAttr = { if ((self = [super init])) { _unmanagedQueue = grpc_completion_queue_create( grpc_completion_queue_factory_lookup(&kCompletionQueueAttr), &kCompletionQueueAttr, NULL); - //_unmanagedQueue = grpc_completion_queue_create_for_next(NULL); // This is for the following block to capture the pointer by value (instead // of retaining self and doing self->_unmanagedQueue). This is essential