aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2016-02-22 22:23:43 -0800
committerGravatar Craig Tiller <ctiller@google.com>2016-02-22 22:23:43 -0800
commitc866f7281f2797fd662c7ba8db555e073aa4db2d (patch)
tree1fc1d5618a0039f21e37bafe331b3b2ba23927c6
parent521423c8cf471bfdc4c7e1294890252220518416 (diff)
parent914a2e7217e3376dfbd69fa37008d6d60f797689 (diff)
Merge github.com:grpc/grpc into naming-crisis
-rw-r--r--BUILD3
-rw-r--r--build.yaml1
-rw-r--r--gRPC.podspec2
-rwxr-xr-xgrpc.gemspec1
-rw-r--r--include/grpc++/server.h6
-rw-r--r--package.json1
-rw-r--r--src/core/iomgr/iocp_windows.c2
-rw-r--r--src/core/iomgr/iomgr.c4
-rw-r--r--src/core/iomgr/pollset_posix.c11
-rw-r--r--src/core/iomgr/pollset_windows.c4
-rw-r--r--src/core/iomgr/timer.c5
-rw-r--r--src/core/iomgr/timer.h22
-rw-r--r--src/core/iomgr/timer_internal.h61
-rw-r--r--src/core/surface/completion_queue.c30
-rw-r--r--src/core/transport/chttp2/internal.h9
-rw-r--r--src/core/transport/chttp2/stream_lists.c22
-rw-r--r--src/core/transport/chttp2/writing.c10
-rw-r--r--src/core/transport/chttp2_transport.c7
-rw-r--r--src/cpp/server/server.cc14
-rw-r--r--src/cpp/server/server_builder.cc2
-rw-r--r--summerofcode/ideas.md24
-rw-r--r--test/core/iomgr/tcp_client_posix_test.c26
-rw-r--r--test/core/iomgr/timer_list_test.c31
-rw-r--r--test/cpp/end2end/async_end2end_test.cc4
-rw-r--r--tools/doxygen/Doxyfile.core.internal1
-rw-r--r--tools/run_tests/sources_and_headers.json4
-rw-r--r--vsprojects/vcxproj/grpc/grpc.vcxproj1
-rw-r--r--vsprojects/vcxproj/grpc/grpc.vcxproj.filters3
-rw-r--r--vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj1
-rw-r--r--vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters3
30 files changed, 158 insertions, 157 deletions
diff --git a/BUILD b/BUILD
index 18a69b47e8..7737def22c 100644
--- a/BUILD
+++ b/BUILD
@@ -219,7 +219,6 @@ cc_library(
"src/core/iomgr/time_averaged_stats.h",
"src/core/iomgr/timer.h",
"src/core/iomgr/timer_heap.h",
- "src/core/iomgr/timer_internal.h",
"src/core/iomgr/udp_server.h",
"src/core/iomgr/wakeup_fd_pipe.h",
"src/core/iomgr/wakeup_fd_posix.h",
@@ -539,7 +538,6 @@ cc_library(
"src/core/iomgr/time_averaged_stats.h",
"src/core/iomgr/timer.h",
"src/core/iomgr/timer_heap.h",
- "src/core/iomgr/timer_internal.h",
"src/core/iomgr/udp_server.h",
"src/core/iomgr/wakeup_fd_pipe.h",
"src/core/iomgr/wakeup_fd_posix.h",
@@ -1485,7 +1483,6 @@ objc_library(
"src/core/iomgr/time_averaged_stats.h",
"src/core/iomgr/timer.h",
"src/core/iomgr/timer_heap.h",
- "src/core/iomgr/timer_internal.h",
"src/core/iomgr/udp_server.h",
"src/core/iomgr/wakeup_fd_pipe.h",
"src/core/iomgr/wakeup_fd_posix.h",
diff --git a/build.yaml b/build.yaml
index 0cb18bb5b0..a58ed67ef4 100644
--- a/build.yaml
+++ b/build.yaml
@@ -309,7 +309,6 @@ filegroups:
- src/core/iomgr/time_averaged_stats.h
- src/core/iomgr/timer.h
- src/core/iomgr/timer_heap.h
- - src/core/iomgr/timer_internal.h
- src/core/iomgr/udp_server.h
- src/core/iomgr/wakeup_fd_pipe.h
- src/core/iomgr/wakeup_fd_posix.h
diff --git a/gRPC.podspec b/gRPC.podspec
index 0b2a99ed82..d0e0eca807 100644
--- a/gRPC.podspec
+++ b/gRPC.podspec
@@ -223,7 +223,6 @@ Pod::Spec.new do |s|
'src/core/iomgr/time_averaged_stats.h',
'src/core/iomgr/timer.h',
'src/core/iomgr/timer_heap.h',
- 'src/core/iomgr/timer_internal.h',
'src/core/iomgr/udp_server.h',
'src/core/iomgr/wakeup_fd_pipe.h',
'src/core/iomgr/wakeup_fd_posix.h',
@@ -534,7 +533,6 @@ Pod::Spec.new do |s|
'src/core/iomgr/time_averaged_stats.h',
'src/core/iomgr/timer.h',
'src/core/iomgr/timer_heap.h',
- 'src/core/iomgr/timer_internal.h',
'src/core/iomgr/udp_server.h',
'src/core/iomgr/wakeup_fd_pipe.h',
'src/core/iomgr/wakeup_fd_posix.h',
diff --git a/grpc.gemspec b/grpc.gemspec
index 6b0a47a79a..a305533220 100755
--- a/grpc.gemspec
+++ b/grpc.gemspec
@@ -219,7 +219,6 @@ Gem::Specification.new do |s|
s.files += %w( src/core/iomgr/time_averaged_stats.h )
s.files += %w( src/core/iomgr/timer.h )
s.files += %w( src/core/iomgr/timer_heap.h )
- s.files += %w( src/core/iomgr/timer_internal.h )
s.files += %w( src/core/iomgr/udp_server.h )
s.files += %w( src/core/iomgr/wakeup_fd_pipe.h )
s.files += %w( src/core/iomgr/wakeup_fd_posix.h )
diff --git a/include/grpc++/server.h b/include/grpc++/server.h
index 2a71073a7e..c177805236 100644
--- a/include/grpc++/server.h
+++ b/include/grpc++/server.h
@@ -79,6 +79,8 @@ class Server GRPC_FINAL : public ServerInterface, private GrpcLibrary {
class GlobalCallbacks {
public:
virtual ~GlobalCallbacks() {}
+ /// Called before server is created.
+ virtual void UpdateArguments(ChannelArguments* args) {}
/// Called before application callback for each synchronous server request
virtual void PreSynchronousRequest(ServerContext* context) = 0;
/// Called after application callback for each synchronous server request
@@ -108,7 +110,7 @@ class Server GRPC_FINAL : public ServerInterface, private GrpcLibrary {
/// \param max_message_size Maximum message length that the channel can
/// receive.
Server(ThreadPoolInterface* thread_pool, bool thread_pool_owned,
- int max_message_size, const ChannelArguments& args);
+ int max_message_size, ChannelArguments* args);
/// Register a service. This call does not take ownership of the service.
/// The service must exist for the lifetime of the Server instance.
@@ -177,7 +179,7 @@ class Server GRPC_FINAL : public ServerInterface, private GrpcLibrary {
bool has_generic_service_;
// Pointer to the c grpc server.
- grpc_server* const server_;
+ grpc_server* server_;
ThreadPoolInterface* thread_pool_;
// Whether the thread pool is created and owned by the server.
diff --git a/package.json b/package.json
index 521452d0c2..d96e545818 100644
--- a/package.json
+++ b/package.json
@@ -163,7 +163,6 @@
"src/core/iomgr/time_averaged_stats.h",
"src/core/iomgr/timer.h",
"src/core/iomgr/timer_heap.h",
- "src/core/iomgr/timer_internal.h",
"src/core/iomgr/udp_server.h",
"src/core/iomgr/wakeup_fd_pipe.h",
"src/core/iomgr/wakeup_fd_posix.h",
diff --git a/src/core/iomgr/iocp_windows.c b/src/core/iomgr/iocp_windows.c
index 759340e00e..807729708e 100644
--- a/src/core/iomgr/iocp_windows.c
+++ b/src/core/iomgr/iocp_windows.c
@@ -42,7 +42,7 @@
#include <grpc/support/alloc.h>
#include <grpc/support/thd.h>
-#include "src/core/iomgr/timer_internal.h"
+#include "src/core/iomgr/timer.h"
#include "src/core/iomgr/iocp_windows.h"
#include "src/core/iomgr/iomgr_internal.h"
#include "src/core/iomgr/socket_windows.h"
diff --git a/src/core/iomgr/iomgr.c b/src/core/iomgr/iomgr.c
index 212ce5534d..04580150f3 100644
--- a/src/core/iomgr/iomgr.c
+++ b/src/core/iomgr/iomgr.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -43,7 +43,7 @@
#include <grpc/support/thd.h>
#include "src/core/iomgr/iomgr_internal.h"
-#include "src/core/iomgr/timer_internal.h"
+#include "src/core/iomgr/timer.h"
#include "src/core/support/string.h"
static gpr_mu g_mu;
diff --git a/src/core/iomgr/pollset_posix.c b/src/core/iomgr/pollset_posix.c
index 19ee6650f0..1063727248 100644
--- a/src/core/iomgr/pollset_posix.c
+++ b/src/core/iomgr/pollset_posix.c
@@ -42,7 +42,6 @@
#include <string.h>
#include <unistd.h>
-#include "src/core/iomgr/timer_internal.h"
#include "src/core/iomgr/fd_posix.h"
#include "src/core/iomgr/iomgr_internal.h"
#include "src/core/iomgr/socket_utils_posix.h"
@@ -274,16 +273,6 @@ void grpc_pollset_work(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset,
grpc_exec_ctx_enqueue_list(exec_ctx, &pollset->idle_jobs, NULL);
goto done;
}
- /* Check alarms - these are a global resource so we just ping
- each time through on every pollset.
- May update deadline to ensure timely wakeups.
- TODO(ctiller): can this work be localized? */
- if (grpc_timer_check(exec_ctx, now, &deadline)) {
- GPR_TIMER_MARK("grpc_pollset_work.alarm_triggered", 0);
- gpr_mu_unlock(&pollset->mu);
- locked = 0;
- goto done;
- }
/* If we're shutting down then we don't execute any extended work */
if (pollset->shutting_down) {
GPR_TIMER_MARK("grpc_pollset_work.shutting_down", 0);
diff --git a/src/core/iomgr/pollset_windows.c b/src/core/iomgr/pollset_windows.c
index 02c6678363..35a956b27f 100644
--- a/src/core/iomgr/pollset_windows.c
+++ b/src/core/iomgr/pollset_windows.c
@@ -38,7 +38,6 @@
#include <grpc/support/log.h>
#include <grpc/support/thd.h>
-#include "src/core/iomgr/timer_internal.h"
#include "src/core/iomgr/iomgr_internal.h"
#include "src/core/iomgr/iocp_windows.h"
#include "src/core/iomgr/pollset.h"
@@ -136,9 +135,6 @@ void grpc_pollset_work(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset,
worker->kicked = 0;
worker->pollset = pollset;
gpr_cv_init(&worker->cv);
- if (grpc_timer_check(exec_ctx, now, &deadline)) {
- goto done;
- }
if (!pollset->kicked_without_pollers && !pollset->shutting_down) {
if (g_active_poller == NULL) {
grpc_pollset_worker *next_worker;
diff --git a/src/core/iomgr/timer.c b/src/core/iomgr/timer.c
index a33d8f63a0..8379fffad0 100644
--- a/src/core/iomgr/timer.c
+++ b/src/core/iomgr/timer.c
@@ -34,7 +34,6 @@
#include "src/core/iomgr/timer.h"
#include "src/core/iomgr/timer_heap.h"
-#include "src/core/iomgr/timer_internal.h"
#include "src/core/iomgr/time_averaged_stats.h"
#include <grpc/support/log.h>
#include <grpc/support/sync.h>
@@ -336,8 +335,8 @@ static int run_some_expired_timers(grpc_exec_ctx *exec_ctx, gpr_timespec now,
return (int)n;
}
-int grpc_timer_check(grpc_exec_ctx *exec_ctx, gpr_timespec now,
- gpr_timespec *next) {
+bool grpc_timer_check(grpc_exec_ctx *exec_ctx, gpr_timespec now,
+ gpr_timespec *next) {
GPR_ASSERT(now.clock_type == g_clock_type);
return run_some_expired_timers(
exec_ctx, now, next,
diff --git a/src/core/iomgr/timer.h b/src/core/iomgr/timer.h
index 720c9d5ab9..9ad1e92f42 100644
--- a/src/core/iomgr/timer.h
+++ b/src/core/iomgr/timer.h
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -86,4 +86,24 @@ void grpc_timer_init(grpc_exec_ctx *exec_ctx, grpc_timer *timer,
Requires: cancel() must happen after add() on a given timer */
void grpc_timer_cancel(grpc_exec_ctx *exec_ctx, grpc_timer *timer);
+/* iomgr internal api for dealing with timers */
+
+/* Check for timers to be run, and run them.
+ Return true if timer callbacks were executed.
+ Drops drop_mu if it is non-null before executing callbacks.
+ If next is non-null, TRY to update *next with the next running timer
+ IF that timer occurs before *next current value.
+ *next is never guaranteed to be updated on any given execution; however,
+ with high probability at least one thread in the system will see an update
+ at any time slice. */
+
+bool grpc_timer_check(grpc_exec_ctx *exec_ctx, gpr_timespec now,
+ gpr_timespec *next);
+void grpc_timer_list_init(gpr_timespec now);
+void grpc_timer_list_shutdown(grpc_exec_ctx *exec_ctx);
+
+/* the following must be implemented by each iomgr implementation */
+
+void grpc_kick_poller(void);
+
#endif /* GRPC_INTERNAL_CORE_IOMGR_TIMER_H */
diff --git a/src/core/iomgr/timer_internal.h b/src/core/iomgr/timer_internal.h
deleted file mode 100644
index f182e73764..0000000000
--- a/src/core/iomgr/timer_internal.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- *
- * Copyright 2015, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#ifndef GRPC_INTERNAL_CORE_IOMGR_TIMER_INTERNAL_H
-#define GRPC_INTERNAL_CORE_IOMGR_TIMER_INTERNAL_H
-
-#include "src/core/iomgr/exec_ctx.h"
-#include <grpc/support/sync.h>
-#include <grpc/support/time.h>
-
-/* iomgr internal api for dealing with timers */
-
-/* Check for timers to be run, and run them.
- Return non zero if timer callbacks were executed.
- Drops drop_mu if it is non-null before executing callbacks.
- If next is non-null, TRY to update *next with the next running timer
- IF that timer occurs before *next current value.
- *next is never guaranteed to be updated on any given execution; however,
- with high probability at least one thread in the system will see an update
- at any time slice. */
-
-int grpc_timer_check(grpc_exec_ctx* exec_ctx, gpr_timespec now,
- gpr_timespec* next);
-void grpc_timer_list_init(gpr_timespec now);
-void grpc_timer_list_shutdown(grpc_exec_ctx* exec_ctx);
-
-/* the following must be implemented by each iomgr implementation */
-
-void grpc_kick_poller(void);
-
-#endif /* GRPC_INTERNAL_CORE_IOMGR_TIMER_INTERNAL_H */
diff --git a/src/core/surface/completion_queue.c b/src/core/surface/completion_queue.c
index 75298eb795..0a80680f02 100644
--- a/src/core/surface/completion_queue.c
+++ b/src/core/surface/completion_queue.c
@@ -323,7 +323,20 @@ grpc_event grpc_completion_queue_next(grpc_completion_queue *cc,
break;
}
first_loop = 0;
- grpc_pollset_work(&exec_ctx, &cc->pollset, &worker, now, deadline);
+ /* Check alarms - these are a global resource so we just ping
+ each time through on every pollset.
+ May update deadline to ensure timely wakeups.
+ TODO(ctiller): can this work be localized? */
+ gpr_timespec iteration_deadline = deadline;
+ if (grpc_timer_check(&exec_ctx, now, &iteration_deadline)) {
+ GPR_TIMER_MARK("alarm_triggered", 0);
+ gpr_mu_unlock(GRPC_POLLSET_MU(&cc->pollset));
+ grpc_exec_ctx_flush(&exec_ctx);
+ gpr_mu_lock(GRPC_POLLSET_MU(&cc->pollset));
+ } else {
+ grpc_pollset_work(&exec_ctx, &cc->pollset, &worker, now,
+ iteration_deadline);
+ }
}
GRPC_SURFACE_TRACE_RETURNED_EVENT(cc, &ret);
GRPC_CQ_INTERNAL_UNREF(cc, "next");
@@ -427,7 +440,20 @@ grpc_event grpc_completion_queue_pluck(grpc_completion_queue *cc, void *tag,
break;
}
first_loop = 0;
- grpc_pollset_work(&exec_ctx, &cc->pollset, &worker, now, deadline);
+ /* Check alarms - these are a global resource so we just ping
+ each time through on every pollset.
+ May update deadline to ensure timely wakeups.
+ TODO(ctiller): can this work be localized? */
+ gpr_timespec iteration_deadline = deadline;
+ if (grpc_timer_check(&exec_ctx, now, &iteration_deadline)) {
+ GPR_TIMER_MARK("alarm_triggered", 0);
+ gpr_mu_unlock(GRPC_POLLSET_MU(&cc->pollset));
+ grpc_exec_ctx_flush(&exec_ctx);
+ gpr_mu_lock(GRPC_POLLSET_MU(&cc->pollset));
+ } else {
+ grpc_pollset_work(&exec_ctx, &cc->pollset, &worker, now,
+ iteration_deadline);
+ }
del_plucker(cc, tag, &worker);
}
done:
diff --git a/src/core/transport/chttp2/internal.h b/src/core/transport/chttp2/internal.h
index 0e1e2c4265..d76d31be23 100644
--- a/src/core/transport/chttp2/internal.h
+++ b/src/core/transport/chttp2/internal.h
@@ -485,7 +485,8 @@ struct grpc_chttp2_stream {
/** Someone is unlocking the transport mutex: check to see if writes
are required, and schedule them if so */
-int grpc_chttp2_unlocking_check_writes(grpc_chttp2_transport_global *global,
+int grpc_chttp2_unlocking_check_writes(grpc_exec_ctx *exec_ctx,
+ grpc_chttp2_transport_global *global,
grpc_chttp2_transport_writing *writing,
int is_parsing);
void grpc_chttp2_perform_writes(
@@ -568,8 +569,12 @@ void grpc_chttp2_list_add_writing_stalled_by_transport(
grpc_chttp2_transport_writing *transport_writing,
grpc_chttp2_stream_writing *stream_writing);
void grpc_chttp2_list_flush_writing_stalled_by_transport(
- grpc_chttp2_transport_writing *transport_writing, bool is_window_available);
+ grpc_exec_ctx *exec_ctx, grpc_chttp2_transport_writing *transport_writing,
+ bool is_window_available);
+void grpc_chttp2_list_add_stalled_by_transport(
+ grpc_chttp2_transport_writing *transport_writing,
+ grpc_chttp2_stream_writing *stream_writing);
int grpc_chttp2_list_pop_stalled_by_transport(
grpc_chttp2_transport_global *transport_global,
grpc_chttp2_stream_global **stream_global);
diff --git a/src/core/transport/chttp2/stream_lists.c b/src/core/transport/chttp2/stream_lists.c
index 2f31a47cb3..b284c78818 100644
--- a/src/core/transport/chttp2/stream_lists.c
+++ b/src/core/transport/chttp2/stream_lists.c
@@ -316,13 +316,16 @@ int grpc_chttp2_list_pop_check_read_ops(
void grpc_chttp2_list_add_writing_stalled_by_transport(
grpc_chttp2_transport_writing *transport_writing,
grpc_chttp2_stream_writing *stream_writing) {
- stream_list_add(TRANSPORT_FROM_WRITING(transport_writing),
- STREAM_FROM_WRITING(stream_writing),
+ grpc_chttp2_stream *stream = STREAM_FROM_WRITING(stream_writing);
+ if (!stream->included[GRPC_CHTTP2_LIST_WRITING_STALLED_BY_TRANSPORT]) {
+ GRPC_CHTTP2_STREAM_REF(&stream->global, "chttp2_writing_stalled");
+ }
+ stream_list_add(TRANSPORT_FROM_WRITING(transport_writing), stream,
GRPC_CHTTP2_LIST_WRITING_STALLED_BY_TRANSPORT);
}
void grpc_chttp2_list_flush_writing_stalled_by_transport(
- grpc_chttp2_transport_writing *transport_writing,
+ grpc_exec_ctx *exec_ctx, grpc_chttp2_transport_writing *transport_writing,
bool is_window_available) {
grpc_chttp2_stream *stream;
grpc_chttp2_transport *transport = TRANSPORT_FROM_WRITING(transport_writing);
@@ -331,11 +334,22 @@ void grpc_chttp2_list_flush_writing_stalled_by_transport(
if (is_window_available) {
grpc_chttp2_list_add_writable_stream(&transport->global, &stream->global);
} else {
- stream_list_add(transport, stream, GRPC_CHTTP2_LIST_STALLED_BY_TRANSPORT);
+ grpc_chttp2_list_add_stalled_by_transport(transport_writing,
+ &stream->writing);
}
+ GRPC_CHTTP2_STREAM_UNREF(exec_ctx, &stream->global,
+ "chttp2_writing_stalled");
}
}
+void grpc_chttp2_list_add_stalled_by_transport(
+ grpc_chttp2_transport_writing *transport_writing,
+ grpc_chttp2_stream_writing *stream_writing) {
+ stream_list_add(TRANSPORT_FROM_WRITING(transport_writing),
+ STREAM_FROM_WRITING(stream_writing),
+ GRPC_CHTTP2_LIST_STALLED_BY_TRANSPORT);
+}
+
int grpc_chttp2_list_pop_stalled_by_transport(
grpc_chttp2_transport_global *transport_global,
grpc_chttp2_stream_global **stream_global) {
diff --git a/src/core/transport/chttp2/writing.c b/src/core/transport/chttp2/writing.c
index cafecf1046..356fd8174a 100644
--- a/src/core/transport/chttp2/writing.c
+++ b/src/core/transport/chttp2/writing.c
@@ -44,7 +44,7 @@ static void finalize_outbuf(grpc_exec_ctx *exec_ctx,
grpc_chttp2_transport_writing *transport_writing);
int grpc_chttp2_unlocking_check_writes(
- grpc_chttp2_transport_global *transport_global,
+ grpc_exec_ctx *exec_ctx, grpc_chttp2_transport_global *transport_global,
grpc_chttp2_transport_writing *transport_writing, int is_parsing) {
grpc_chttp2_stream_global *stream_global;
grpc_chttp2_stream_writing *stream_writing;
@@ -76,8 +76,8 @@ int grpc_chttp2_unlocking_check_writes(
GRPC_CHTTP2_FLOW_MOVE_TRANSPORT("write", transport_writing, outgoing_window,
transport_global, outgoing_window);
bool is_window_available = transport_writing->outgoing_window > 0;
- grpc_chttp2_list_flush_writing_stalled_by_transport(transport_writing,
- is_window_available);
+ grpc_chttp2_list_flush_writing_stalled_by_transport(
+ exec_ctx, transport_writing, is_window_available);
/* for each grpc_chttp2_stream that's become writable, frame it's data
(according to available window sizes) and add to the output buffer */
@@ -133,8 +133,8 @@ int grpc_chttp2_unlocking_check_writes(
GRPC_CHTTP2_STREAM_REF(stream_global, "chttp2_writing");
}
} else {
- grpc_chttp2_list_add_writing_stalled_by_transport(transport_writing,
- stream_writing);
+ grpc_chttp2_list_add_stalled_by_transport(transport_writing,
+ stream_writing);
}
}
if (stream_global->send_trailing_metadata) {
diff --git a/src/core/transport/chttp2_transport.c b/src/core/transport/chttp2_transport.c
index 617d98875c..b9f511e946 100644
--- a/src/core/transport/chttp2_transport.c
+++ b/src/core/transport/chttp2_transport.c
@@ -598,7 +598,7 @@ static void lock(grpc_chttp2_transport *t) { gpr_mu_lock(&t->mu); }
static void unlock(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t) {
GPR_TIMER_BEGIN("unlock", 0);
if (!t->writing_active && !t->closed &&
- grpc_chttp2_unlocking_check_writes(&t->global, &t->writing,
+ grpc_chttp2_unlocking_check_writes(exec_ctx, &t->global, &t->writing,
t->parsing_active)) {
t->writing_active = 1;
REF_TRANSPORT(t, "writing");
@@ -1019,6 +1019,11 @@ static void check_read_ops(grpc_exec_ctx *exec_ctx,
stream_global->recv_initial_metadata_ready = NULL;
}
if (stream_global->recv_message_ready != NULL) {
+ while (stream_global->seen_error &&
+ (bs = grpc_chttp2_incoming_frame_queue_pop(
+ &stream_global->incoming_frames)) != NULL) {
+ grpc_byte_stream_destroy(exec_ctx, bs);
+ }
if (stream_global->incoming_frames.head != NULL) {
*stream_global->recv_message = grpc_chttp2_incoming_frame_queue_pop(
&stream_global->incoming_frames);
diff --git a/src/cpp/server/server.cc b/src/cpp/server/server.cc
index 0d31140924..6d31a608c8 100644
--- a/src/cpp/server/server.cc
+++ b/src/cpp/server/server.cc
@@ -272,27 +272,25 @@ class Server::SyncRequest GRPC_FINAL : public CompletionQueueTag {
grpc_completion_queue* cq_;
};
-static grpc_server* CreateServer(const ChannelArguments& args) {
- grpc_channel_args channel_args;
- args.SetChannelArgs(&channel_args);
- return grpc_server_create(&channel_args, nullptr);
-}
-
static internal::GrpcLibraryInitializer g_gli_initializer;
Server::Server(ThreadPoolInterface* thread_pool, bool thread_pool_owned,
- int max_message_size, const ChannelArguments& args)
+ int max_message_size, ChannelArguments* args)
: max_message_size_(max_message_size),
started_(false),
shutdown_(false),
num_running_cb_(0),
sync_methods_(new std::list<SyncRequest>),
has_generic_service_(false),
- server_(CreateServer(args)),
+ server_(nullptr),
thread_pool_(thread_pool),
thread_pool_owned_(thread_pool_owned) {
g_gli_initializer.summon();
gpr_once_init(&g_once_init_callbacks, InitGlobalCallbacks);
global_callbacks_ = g_callbacks;
+ global_callbacks_->UpdateArguments(args);
+ grpc_channel_args channel_args;
+ args->SetChannelArgs(&channel_args);
+ server_ = grpc_server_create(&channel_args, nullptr);
grpc_server_register_completion_queue(server_, cq_.cq(), nullptr);
}
diff --git a/src/cpp/server/server_builder.cc b/src/cpp/server/server_builder.cc
index c54cf6474f..134e5f1d5f 100644
--- a/src/cpp/server/server_builder.cc
+++ b/src/cpp/server/server_builder.cc
@@ -103,7 +103,7 @@ std::unique_ptr<Server> ServerBuilder::BuildAndStart() {
args.SetInt(GRPC_COMPRESSION_ALGORITHM_STATE_ARG,
compression_options_.enabled_algorithms_bitset);
std::unique_ptr<Server> server(
- new Server(thread_pool.release(), true, max_message_size_, args));
+ new Server(thread_pool.release(), true, max_message_size_, &args));
for (auto cq = cqs_.begin(); cq != cqs_.end(); ++cq) {
grpc_server_register_completion_queue(server->server_, (*cq)->cq(),
nullptr);
diff --git a/summerofcode/ideas.md b/summerofcode/ideas.md
index 073262339b..b14d3f7b6a 100644
--- a/summerofcode/ideas.md
+++ b/summerofcode/ideas.md
@@ -1,4 +1,22 @@
-Google Summer of Code 2016 gRPC Ideas
-=====================================
+# gRPC Summer of Code Project Ideas
-(Skeleton for now.)
+C Core:
+
+1. Port gRPC to one of (Free, Net, Open) BSD platforms and create packages for them. Add kqueue support in the process.
+2. Fix gRPC C-core's URI parser. The current parser does not qualify as a standard parser according to [RFC3986]( https://tools.ietf.org/html/rfc3986). Write test suites to verify this and make changes necessary to make the URI parser compliant.
+3. HPACK compression efficiency evaluation - Figure out how to benchmark gRPC's compression efficiency (both in terms of bytes on the wire and cpu cycles). Implement benchmarks. Potentially extend this to other standalone implementations -- Java and Go.
+
+
+gRPC Python:
+
+ 1. Evaluate the port of gRPC's Python implementation to PyPy. Investigate the state of [Cython support](http://docs.cython.org/src/userguide/pypy.html) to do this or potentially explore cffi
+ 2. Develop and test Python 3.5 Support for gRPC. Make necessary changes to port gRPC and package it for supported platforms.
+
+gRPC Ruby/Java:
+
+1. jRuby support for gRPC. Develop a jRuby wrapper for gRPC based on grpc-java and ensure that it is API compatible with the existing Ruby implementation and passes all tests.
+
+
+Other:
+
+1. Develop a Wireshark plugin for the gRPC protocol. Provide documentation and tutorials for this plugin. Bonus: consider set-up and use with the mobile clients.
diff --git a/test/core/iomgr/tcp_client_posix_test.c b/test/core/iomgr/tcp_client_posix_test.c
index 9725d8a3b6..b57478059f 100644
--- a/test/core/iomgr/tcp_client_posix_test.c
+++ b/test/core/iomgr/tcp_client_posix_test.c
@@ -45,6 +45,7 @@
#include "src/core/iomgr/iomgr.h"
#include "src/core/iomgr/socket_utils_posix.h"
+#include "src/core/iomgr/timer.h"
#include "test/core/util/test_config.h"
static grpc_pollset_set g_pollset_set;
@@ -125,11 +126,13 @@ void test_succeeds(void) {
gpr_now(GPR_CLOCK_MONOTONIC),
GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5));
gpr_mu_unlock(GRPC_POLLSET_MU(&g_pollset));
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_flush(&exec_ctx);
gpr_mu_lock(GRPC_POLLSET_MU(&g_pollset));
}
gpr_mu_unlock(GRPC_POLLSET_MU(&g_pollset));
+
+ grpc_exec_ctx_finish(&exec_ctx);
}
void test_fails(void) {
@@ -159,14 +162,18 @@ void test_fails(void) {
/* wait for the connection callback to finish */
while (g_connections_complete == connections_complete_before) {
grpc_pollset_worker worker;
- grpc_pollset_work(&exec_ctx, &g_pollset, &worker,
- gpr_now(GPR_CLOCK_MONOTONIC), test_deadline());
+ gpr_timespec now = gpr_now(GPR_CLOCK_MONOTONIC);
+ gpr_timespec polling_deadline = test_deadline();
+ if (!grpc_timer_check(&exec_ctx, now, &polling_deadline)) {
+ grpc_pollset_work(&exec_ctx, &g_pollset, &worker, now, polling_deadline);
+ }
gpr_mu_unlock(GRPC_POLLSET_MU(&g_pollset));
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_flush(&exec_ctx);
gpr_mu_lock(GRPC_POLLSET_MU(&g_pollset));
}
gpr_mu_unlock(GRPC_POLLSET_MU(&g_pollset));
+ grpc_exec_ctx_finish(&exec_ctx);
}
void test_times_out(void) {
@@ -243,15 +250,18 @@ void test_times_out(void) {
GPR_ASSERT(g_connections_complete ==
connections_complete_before + is_after_deadline);
}
- grpc_pollset_work(&exec_ctx, &g_pollset, &worker,
- gpr_now(GPR_CLOCK_MONOTONIC),
- GRPC_TIMEOUT_MILLIS_TO_DEADLINE(10));
+ gpr_timespec polling_deadline = GRPC_TIMEOUT_MILLIS_TO_DEADLINE(10);
+ if (!grpc_timer_check(&exec_ctx, now, &polling_deadline)) {
+ grpc_pollset_work(&exec_ctx, &g_pollset, &worker, now, polling_deadline);
+ }
gpr_mu_unlock(GRPC_POLLSET_MU(&g_pollset));
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_exec_ctx_flush(&exec_ctx);
gpr_mu_lock(GRPC_POLLSET_MU(&g_pollset));
}
gpr_mu_unlock(GRPC_POLLSET_MU(&g_pollset));
+ grpc_exec_ctx_finish(&exec_ctx);
+
close(svr_fd);
for (i = 0; i < NUM_CLIENT_CONNECTS; ++i) {
close(client_fd[i]);
diff --git a/test/core/iomgr/timer_list_test.c b/test/core/iomgr/timer_list_test.c
index 15de87c5a1..7a21fdd5c1 100644
--- a/test/core/iomgr/timer_list_test.c
+++ b/test/core/iomgr/timer_list_test.c
@@ -35,7 +35,6 @@
#include <string.h>
-#include "src/core/iomgr/timer_internal.h"
#include <grpc/support/log.h>
#include "test/core/util/test_config.h"
@@ -72,20 +71,19 @@ static void add_test(void) {
}
/* collect timers. Only the first batch should be ready. */
- GPR_ASSERT(10 == grpc_timer_check(&exec_ctx,
- gpr_time_add(start, gpr_time_from_millis(
- 500, GPR_TIMESPAN)),
- NULL));
+ GPR_ASSERT(grpc_timer_check(
+ &exec_ctx, gpr_time_add(start, gpr_time_from_millis(500, GPR_TIMESPAN)),
+ NULL));
grpc_exec_ctx_finish(&exec_ctx);
for (i = 0; i < 20; i++) {
GPR_ASSERT(cb_called[i][1] == (i < 10));
GPR_ASSERT(cb_called[i][0] == 0);
}
- GPR_ASSERT(0 == grpc_timer_check(&exec_ctx,
- gpr_time_add(start, gpr_time_from_millis(
- 600, GPR_TIMESPAN)),
- NULL));
+ GPR_ASSERT(!grpc_timer_check(
+ &exec_ctx,
+ gpr_time_add(start, gpr_time_from_millis(600, GPR_TIMESPAN)),
+ NULL));
grpc_exec_ctx_finish(&exec_ctx);
for (i = 0; i < 30; i++) {
GPR_ASSERT(cb_called[i][1] == (i < 10));
@@ -93,20 +91,19 @@ static void add_test(void) {
}
/* collect the rest of the timers */
- GPR_ASSERT(10 == grpc_timer_check(
- &exec_ctx, gpr_time_add(start, gpr_time_from_millis(
- 1500, GPR_TIMESPAN)),
- NULL));
+ GPR_ASSERT(grpc_timer_check(
+ &exec_ctx, gpr_time_add(start, gpr_time_from_millis(1500, GPR_TIMESPAN)),
+ NULL));
grpc_exec_ctx_finish(&exec_ctx);
for (i = 0; i < 30; i++) {
GPR_ASSERT(cb_called[i][1] == (i < 20));
GPR_ASSERT(cb_called[i][0] == 0);
}
- GPR_ASSERT(0 == grpc_timer_check(&exec_ctx,
- gpr_time_add(start, gpr_time_from_millis(
- 1600, GPR_TIMESPAN)),
- NULL));
+ GPR_ASSERT(!grpc_timer_check(
+ &exec_ctx,
+ gpr_time_add(start, gpr_time_from_millis(1600, GPR_TIMESPAN)),
+ NULL));
for (i = 0; i < 30; i++) {
GPR_ASSERT(cb_called[i][1] == (i < 20));
GPR_ASSERT(cb_called[i][0] == 0);
diff --git a/test/cpp/end2end/async_end2end_test.cc b/test/cpp/end2end/async_end2end_test.cc
index a15cbd7ee2..9ca3bf98f8 100644
--- a/test/cpp/end2end/async_end2end_test.cc
+++ b/test/cpp/end2end/async_end2end_test.cc
@@ -989,6 +989,10 @@ class AsyncEnd2endServerTryCancelTest : public AsyncEnd2endTest {
if (server_try_cancel == CANCEL_AFTER_PROCESSING) {
ServerTryCancel(&srv_ctx);
+
+ // Client reads may fail bacause it is notified that the stream is
+ // cancelled.
+ ignore_cq_result = true;
}
// Client attemts to read the three messages from the server
diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal
index 41233f24e4..4831071ba5 100644
--- a/tools/doxygen/Doxyfile.core.internal
+++ b/tools/doxygen/Doxyfile.core.internal
@@ -837,7 +837,6 @@ src/core/iomgr/tcp_windows.h \
src/core/iomgr/time_averaged_stats.h \
src/core/iomgr/timer.h \
src/core/iomgr/timer_heap.h \
-src/core/iomgr/timer_internal.h \
src/core/iomgr/udp_server.h \
src/core/iomgr/wakeup_fd_pipe.h \
src/core/iomgr/wakeup_fd_posix.h \
diff --git a/tools/run_tests/sources_and_headers.json b/tools/run_tests/sources_and_headers.json
index a1bdd5e6e9..36cd19e6b2 100644
--- a/tools/run_tests/sources_and_headers.json
+++ b/tools/run_tests/sources_and_headers.json
@@ -3902,7 +3902,6 @@
"src/core/iomgr/time_averaged_stats.h",
"src/core/iomgr/timer.h",
"src/core/iomgr/timer_heap.h",
- "src/core/iomgr/timer_internal.h",
"src/core/iomgr/udp_server.h",
"src/core/iomgr/wakeup_fd_pipe.h",
"src/core/iomgr/wakeup_fd_posix.h",
@@ -4125,7 +4124,6 @@
"src/core/iomgr/timer.h",
"src/core/iomgr/timer_heap.c",
"src/core/iomgr/timer_heap.h",
- "src/core/iomgr/timer_internal.h",
"src/core/iomgr/udp_server.c",
"src/core/iomgr/udp_server.h",
"src/core/iomgr/wakeup_fd_eventfd.c",
@@ -4451,7 +4449,6 @@
"src/core/iomgr/time_averaged_stats.h",
"src/core/iomgr/timer.h",
"src/core/iomgr/timer_heap.h",
- "src/core/iomgr/timer_internal.h",
"src/core/iomgr/udp_server.h",
"src/core/iomgr/wakeup_fd_pipe.h",
"src/core/iomgr/wakeup_fd_posix.h",
@@ -4658,7 +4655,6 @@
"src/core/iomgr/timer.h",
"src/core/iomgr/timer_heap.c",
"src/core/iomgr/timer_heap.h",
- "src/core/iomgr/timer_internal.h",
"src/core/iomgr/udp_server.c",
"src/core/iomgr/udp_server.h",
"src/core/iomgr/wakeup_fd_eventfd.c",
diff --git a/vsprojects/vcxproj/grpc/grpc.vcxproj b/vsprojects/vcxproj/grpc/grpc.vcxproj
index e6ed1c34de..f36cc5b11a 100644
--- a/vsprojects/vcxproj/grpc/grpc.vcxproj
+++ b/vsprojects/vcxproj/grpc/grpc.vcxproj
@@ -346,7 +346,6 @@
<ClInclude Include="$(SolutionDir)\..\src\core\iomgr\time_averaged_stats.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\iomgr\timer.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\iomgr\timer_heap.h" />
- <ClInclude Include="$(SolutionDir)\..\src\core\iomgr\timer_internal.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\iomgr\udp_server.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\iomgr\wakeup_fd_pipe.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\iomgr\wakeup_fd_posix.h" />
diff --git a/vsprojects/vcxproj/grpc/grpc.vcxproj.filters b/vsprojects/vcxproj/grpc/grpc.vcxproj.filters
index bfa9ba1189..2f563083b6 100644
--- a/vsprojects/vcxproj/grpc/grpc.vcxproj.filters
+++ b/vsprojects/vcxproj/grpc/grpc.vcxproj.filters
@@ -701,9 +701,6 @@
<ClInclude Include="$(SolutionDir)\..\src\core\iomgr\timer_heap.h">
<Filter>src\core\iomgr</Filter>
</ClInclude>
- <ClInclude Include="$(SolutionDir)\..\src\core\iomgr\timer_internal.h">
- <Filter>src\core\iomgr</Filter>
- </ClInclude>
<ClInclude Include="$(SolutionDir)\..\src\core\iomgr\udp_server.h">
<Filter>src\core\iomgr</Filter>
</ClInclude>
diff --git a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj
index eadb69318b..0e065f983f 100644
--- a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj
+++ b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj
@@ -336,7 +336,6 @@
<ClInclude Include="$(SolutionDir)\..\src\core\iomgr\time_averaged_stats.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\iomgr\timer.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\iomgr\timer_heap.h" />
- <ClInclude Include="$(SolutionDir)\..\src\core\iomgr\timer_internal.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\iomgr\udp_server.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\iomgr\wakeup_fd_pipe.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\iomgr\wakeup_fd_posix.h" />
diff --git a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters
index d104fad1b1..7440ec8dd6 100644
--- a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters
+++ b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters
@@ -638,9 +638,6 @@
<ClInclude Include="$(SolutionDir)\..\src\core\iomgr\timer_heap.h">
<Filter>src\core\iomgr</Filter>
</ClInclude>
- <ClInclude Include="$(SolutionDir)\..\src\core\iomgr\timer_internal.h">
- <Filter>src\core\iomgr</Filter>
- </ClInclude>
<ClInclude Include="$(SolutionDir)\..\src\core\iomgr\udp_server.h">
<Filter>src\core\iomgr</Filter>
</ClInclude>