diff options
author | Alistair Veitch <aveitch@google.com> | 2016-02-08 13:08:24 -0800 |
---|---|---|
committer | Alistair Veitch <aveitch@google.com> | 2016-02-08 13:08:24 -0800 |
commit | e28e426af542030ea81bbaaedc1417ce9027b95f (patch) | |
tree | c68b8c61b86741aed53aae63a2bccbf9018969f7 /src/core | |
parent | 2e7d06703d3f50fb4f28d352b1a2ae83a18777bf (diff) | |
parent | 81b780b84b77a093ac2273865cd1af8a0f6f69bf (diff) |
Merge branch 'master' into base_log
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/iomgr/iocp_windows.c | 2 | ||||
-rw-r--r-- | src/core/iomgr/pollset_posix.c | 2 | ||||
-rw-r--r-- | src/core/iomgr/tcp_server.h | 11 | ||||
-rw-r--r-- | src/core/support/stack_lockfree.c | 2 | ||||
-rw-r--r-- | src/core/support/sync_win32.c | 1 | ||||
-rw-r--r-- | src/core/support/time.c | 38 | ||||
-rw-r--r-- | src/core/transport/chttp2/writing.c | 7 |
7 files changed, 31 insertions, 32 deletions
diff --git a/src/core/iomgr/iocp_windows.c b/src/core/iomgr/iocp_windows.c index 96b6f81024..759340e00e 100644 --- a/src/core/iomgr/iocp_windows.c +++ b/src/core/iomgr/iocp_windows.c @@ -57,7 +57,7 @@ static HANDLE g_iocp; static DWORD deadline_to_millis_timeout(gpr_timespec deadline, gpr_timespec now) { gpr_timespec timeout; - static const int max_spin_polling_us = 10; + static const int64_t max_spin_polling_us = 10; if (gpr_time_cmp(deadline, gpr_inf_future(deadline.clock_type)) == 0) { return INFINITE; } diff --git a/src/core/iomgr/pollset_posix.c b/src/core/iomgr/pollset_posix.c index a8e2e22977..19ee6650f0 100644 --- a/src/core/iomgr/pollset_posix.c +++ b/src/core/iomgr/pollset_posix.c @@ -393,7 +393,7 @@ void grpc_pollset_shutdown(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset, int grpc_poll_deadline_to_millis_timeout(gpr_timespec deadline, gpr_timespec now) { gpr_timespec timeout; - static const int max_spin_polling_us = 10; + static const int64_t max_spin_polling_us = 10; if (gpr_time_cmp(deadline, gpr_inf_future(deadline.clock_type)) == 0) { return -1; } diff --git a/src/core/iomgr/tcp_server.h b/src/core/iomgr/tcp_server.h index 8f3184ff1e..a39dd3bafc 100644 --- a/src/core/iomgr/tcp_server.h +++ b/src/core/iomgr/tcp_server.h @@ -40,15 +40,14 @@ /* Forward decl of grpc_tcp_server */ typedef struct grpc_tcp_server grpc_tcp_server; -typedef struct grpc_tcp_server_acceptor grpc_tcp_server_acceptor; -struct grpc_tcp_server_acceptor { +typedef struct grpc_tcp_server_acceptor { /* grpc_tcp_server_cb functions share a ref on from_server that is valid until the function returns. */ grpc_tcp_server *from_server; /* Indices that may be passed to grpc_tcp_server_port_fd(). */ unsigned port_index; unsigned fd_index; -}; +} grpc_tcp_server_acceptor; /* Called for newly connected TCP connections. */ typedef void (*grpc_tcp_server_cb)(grpc_exec_ctx *exec_ctx, void *arg, @@ -57,7 +56,7 @@ typedef void (*grpc_tcp_server_cb)(grpc_exec_ctx *exec_ctx, void *arg, /* Create a server, initially not bound to any ports. The caller owns one ref. If shutdown_complete is not NULL, it will be used by - grpc_tcp_server_unref(). */ + grpc_tcp_server_unref() when the ref count reaches zero. */ grpc_tcp_server *grpc_tcp_server_create(grpc_closure *shutdown_complete); /* Start listening to bound ports */ @@ -84,7 +83,7 @@ unsigned grpc_tcp_server_port_fd_count(grpc_tcp_server *s, unsigned port_index); /* Returns the file descriptor of the Mth (fd_index) listening socket of the Nth (port_index) call to add_port() on this server, or -1 if the indices are out of bounds. The file descriptor remains owned by the server, and will be - cleaned up when grpc_tcp_server_destroy is called. */ + cleaned up when the ref count reaches zero. */ int grpc_tcp_server_port_fd(grpc_tcp_server *s, unsigned port_index, unsigned fd_index); @@ -97,7 +96,7 @@ grpc_tcp_server *grpc_tcp_server_ref(grpc_tcp_server *s); void grpc_tcp_server_shutdown_starting_add(grpc_tcp_server *s, grpc_closure *shutdown_starting); -/* If the recount drops to zero, delete s, and call (exec_ctx==NULL) or enqueue +/* If the refcount drops to zero, delete s, and call (exec_ctx==NULL) or enqueue a call (exec_ctx!=NULL) to shutdown_complete. */ void grpc_tcp_server_unref(grpc_exec_ctx *exec_ctx, grpc_tcp_server *s); diff --git a/src/core/support/stack_lockfree.c b/src/core/support/stack_lockfree.c index 2c97ee18be..9daecd2e18 100644 --- a/src/core/support/stack_lockfree.c +++ b/src/core/support/stack_lockfree.c @@ -99,7 +99,7 @@ gpr_stack_lockfree *gpr_stack_lockfree_create(size_t entries) { /* Point the head at reserved dummy entry */ stack->head.contents.index = INVALID_ENTRY_INDEX; - /* Fill in the pad and aba_ctr to avoid confusing memcheck tools */ +/* Fill in the pad and aba_ctr to avoid confusing memcheck tools */ #ifdef GPR_ARCH_64 stack->head.contents.pad = 0; #endif diff --git a/src/core/support/sync_win32.c b/src/core/support/sync_win32.c index 84d412a75f..41998ebcb6 100644 --- a/src/core/support/sync_win32.c +++ b/src/core/support/sync_win32.c @@ -87,6 +87,7 @@ int gpr_cv_wait(gpr_cv *cv, gpr_mu *mu, gpr_timespec abs_deadline) { 0) { SleepConditionVariableCS(cv, &mu->cs, INFINITE); } else { + abs_deadline = gpr_convert_clock_type(abs_deadline, GPR_CLOCK_REALTIME); gpr_timespec now = gpr_now(abs_deadline.clock_type); int64_t now_ms = (int64_t)now.tv_sec * 1000 + now.tv_nsec / 1000000; int64_t deadline_ms = diff --git a/src/core/support/time.c b/src/core/support/time.c index ac8c3bcde5..423d12ffc0 100644 --- a/src/core/support/time.c +++ b/src/core/support/time.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 @@ -83,12 +83,12 @@ gpr_timespec gpr_inf_past(gpr_clock_type type) { /* TODO(ctiller): consider merging _nanos, _micros, _millis into a single function for maintainability. Similarly for _seconds, _minutes, and _hours */ -gpr_timespec gpr_time_from_nanos(long ns, gpr_clock_type type) { +gpr_timespec gpr_time_from_nanos(int64_t ns, gpr_clock_type type) { gpr_timespec result; result.clock_type = type; - if (ns == LONG_MAX) { + if (ns == INT64_MAX) { result = gpr_inf_future(type); - } else if (ns == LONG_MIN) { + } else if (ns == INT64_MIN) { result = gpr_inf_past(type); } else if (ns >= 0) { result.tv_sec = ns / GPR_NS_PER_SEC; @@ -101,12 +101,12 @@ gpr_timespec gpr_time_from_nanos(long ns, gpr_clock_type type) { return result; } -gpr_timespec gpr_time_from_micros(long us, gpr_clock_type type) { +gpr_timespec gpr_time_from_micros(int64_t us, gpr_clock_type type) { gpr_timespec result; result.clock_type = type; - if (us == LONG_MAX) { + if (us == INT64_MAX) { result = gpr_inf_future(type); - } else if (us == LONG_MIN) { + } else if (us == INT64_MIN) { result = gpr_inf_past(type); } else if (us >= 0) { result.tv_sec = us / 1000000; @@ -119,12 +119,12 @@ gpr_timespec gpr_time_from_micros(long us, gpr_clock_type type) { return result; } -gpr_timespec gpr_time_from_millis(long ms, gpr_clock_type type) { +gpr_timespec gpr_time_from_millis(int64_t ms, gpr_clock_type type) { gpr_timespec result; result.clock_type = type; - if (ms == LONG_MAX) { + if (ms == INT64_MAX) { result = gpr_inf_future(type); - } else if (ms == LONG_MIN) { + } else if (ms == INT64_MIN) { result = gpr_inf_past(type); } else if (ms >= 0) { result.tv_sec = ms / 1000; @@ -137,12 +137,12 @@ gpr_timespec gpr_time_from_millis(long ms, gpr_clock_type type) { return result; } -gpr_timespec gpr_time_from_seconds(long s, gpr_clock_type type) { +gpr_timespec gpr_time_from_seconds(int64_t s, gpr_clock_type type) { gpr_timespec result; result.clock_type = type; - if (s == LONG_MAX) { + if (s == INT64_MAX) { result = gpr_inf_future(type); - } else if (s == LONG_MIN) { + } else if (s == INT64_MIN) { result = gpr_inf_past(type); } else { result.tv_sec = s; @@ -151,12 +151,12 @@ gpr_timespec gpr_time_from_seconds(long s, gpr_clock_type type) { return result; } -gpr_timespec gpr_time_from_minutes(long m, gpr_clock_type type) { +gpr_timespec gpr_time_from_minutes(int64_t m, gpr_clock_type type) { gpr_timespec result; result.clock_type = type; - if (m >= LONG_MAX / 60) { + if (m >= INT64_MAX / 60) { result = gpr_inf_future(type); - } else if (m <= LONG_MIN / 60) { + } else if (m <= INT64_MIN / 60) { result = gpr_inf_past(type); } else { result.tv_sec = m * 60; @@ -165,12 +165,12 @@ gpr_timespec gpr_time_from_minutes(long m, gpr_clock_type type) { return result; } -gpr_timespec gpr_time_from_hours(long h, gpr_clock_type type) { +gpr_timespec gpr_time_from_hours(int64_t h, gpr_clock_type type) { gpr_timespec result; result.clock_type = type; - if (h >= LONG_MAX / 3600) { + if (h >= INT64_MAX / 3600) { result = gpr_inf_future(type); - } else if (h <= LONG_MIN / 3600) { + } else if (h <= INT64_MIN / 3600) { result = gpr_inf_past(type); } else { result.tv_sec = h * 3600; diff --git a/src/core/transport/chttp2/writing.c b/src/core/transport/chttp2/writing.c index 095883c66d..cafecf1046 100644 --- a/src/core/transport/chttp2/writing.c +++ b/src/core/transport/chttp2/writing.c @@ -75,6 +75,9 @@ 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); /* for each grpc_chttp2_stream that's become writable, frame it's data (according to available window sizes) and add to the output buffer */ @@ -329,10 +332,6 @@ void grpc_chttp2_cleanup_writing( grpc_chttp2_transport_writing *transport_writing) { grpc_chttp2_stream_writing *stream_writing; grpc_chttp2_stream_global *stream_global; - bool is_window_available = transport_writing->outgoing_window > 0; - - grpc_chttp2_list_flush_writing_stalled_by_transport(transport_writing, - is_window_available); while (grpc_chttp2_list_pop_written_stream( transport_global, transport_writing, &stream_global, &stream_writing)) { |