diff options
author | 2015-01-07 14:03:30 -0800 | |
---|---|---|
committer | 2015-01-08 13:01:56 -0800 | |
commit | 1a277ecd93e908a47a905d323a4a1a77287cede1 (patch) | |
tree | d1648196ca8201d778e73c7c9e59a8ac90613763 /src/core/channel/client_channel.c | |
parent | 3040cb7c434e83c0e70839ac20218f1c2d77e1eb (diff) |
Remove libevent.
Fixed any exposed bugs across the stack.
Add a poll() based implementation. Heavily leverages pollset infrastructure to allow small polls to be the norm. Exposes a mechanism to plug in epoll/kqueue for platforms where we have them.
Simplify iomgr callbacks to return one bit of success or failure (instead of the multi valued result that was mostly unused previously). This will ease the burden on new implementations, and the previous system provided no real value anyway.
Removed timeouts on endpoint read/write routines. This simplifies porting burden by providing a more orthogonal interface, and the functionality can always be replicated when desired by using an alarm combined with endpoint_shutdown. I'm fairly certain we ended up with this interface because it was convenient to do from libevent.
Things that need attention still:
- adding an fd to a pollset is O(n^2) - but this is probably ok given that we'll not
use this for multipolling once platform specific implementations are added.
- we rely on the backup poller too often - especially for SSL handshakes and for client
connection establishment we should have a better mechanism ([] []
- Linux needs to use epoll for multiple fds, FreeBSD variants (including
Darwin) need to use kqueue. ([] []
- Linux needs to use eventfd for poll kicking. ([]
Change on 2015/01/07 by ctiller <ctiller@google.com>
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=83461069
Diffstat (limited to 'src/core/channel/client_channel.c')
-rw-r--r-- | src/core/channel/client_channel.c | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/src/core/channel/client_channel.c b/src/core/channel/client_channel.c index fd883a08ca..46283835a0 100644 --- a/src/core/channel/client_channel.c +++ b/src/core/channel/client_channel.c @@ -294,14 +294,6 @@ static void call_op(grpc_call_element *elem, grpc_call_element *from_elem, } } -static void finally_destroy_channel(void *arg, grpc_iomgr_cb_status status) { - grpc_child_channel_destroy(arg); -} - -static void destroy_channel_later(grpc_child_channel *channel) { - grpc_iomgr_add_callback(finally_destroy_channel, channel); -} - static void channel_op(grpc_channel_element *elem, grpc_channel_element *from_elem, grpc_channel_op *op) { channel_data *chand = elem->channel_data; @@ -317,7 +309,7 @@ static void channel_op(grpc_channel_element *elem, gpr_mu_unlock(&chand->mu); if (child_channel) { grpc_child_channel_handle_op(child_channel, op); - destroy_channel_later(child_channel); + grpc_child_channel_destroy(child_channel, 1); } else { gpr_slice_unref(op->data.goaway.message); } @@ -329,7 +321,7 @@ static void channel_op(grpc_channel_element *elem, chand->active_child = NULL; gpr_mu_unlock(&chand->mu); if (child_channel) { - destroy_channel_later(child_channel); + grpc_child_channel_destroy(child_channel, 1); } break; case GRPC_TRANSPORT_GOAWAY: @@ -344,7 +336,7 @@ static void channel_op(grpc_channel_element *elem, } gpr_mu_unlock(&chand->mu); if (child_channel) { - destroy_channel_later(child_channel); + grpc_child_channel_destroy(child_channel, 0); } gpr_slice_unref(op->data.goaway.message); break; @@ -360,7 +352,7 @@ static void channel_op(grpc_channel_element *elem, } gpr_mu_unlock(&chand->mu); if (child_channel) { - destroy_channel_later(child_channel); + grpc_child_channel_destroy(child_channel, 0); } break; default: @@ -445,7 +437,7 @@ static void destroy_channel_elem(grpc_channel_element *elem) { grpc_transport_setup_cancel(chand->transport_setup); if (chand->active_child) { - grpc_child_channel_destroy(chand->active_child); + grpc_child_channel_destroy(chand->active_child, 1); chand->active_child = NULL; } @@ -549,7 +541,7 @@ grpc_transport_setup_result grpc_client_channel_transport_setup_complete( gpr_free(child_filters); if (old_active) { - grpc_child_channel_destroy(old_active); + grpc_child_channel_destroy(old_active, 1); } return result; |