Merge branch 'master' into base_log

pull/5098/head
Alistair Veitch 9 years ago
commit e28e426af5
  1. 22
      Rakefile
  2. 4
      examples/node/greeter_client.js
  3. 4
      examples/node/greeter_server.js
  4. 7
      examples/node/package.json
  5. 6
      examples/node/route_guide/route_guide_client.js
  6. 6
      examples/node/route_guide/route_guide_server.js
  7. 4
      examples/objective-c/helloworld/main.m
  8. 1
      grpc.gemspec
  9. 3
      include/grpc/impl/codegen/sync.h
  10. 18
      include/grpc/impl/codegen/time.h
  11. 4
      setup.py
  12. 2
      src/core/iomgr/iocp_windows.c
  13. 2
      src/core/iomgr/pollset_posix.c
  14. 11
      src/core/iomgr/tcp_server.h
  15. 2
      src/core/support/stack_lockfree.c
  16. 1
      src/core/support/sync_win32.c
  17. 38
      src/core/support/time.c
  18. 7
      src/core/transport/chttp2/writing.c
  19. 5
      src/node/ext/timeval.cc
  20. 16
      src/objective-c/GRPCClient/GRPCCall+ChannelArg.h
  21. 23
      src/objective-c/GRPCClient/GRPCCall+ChannelArg.m
  22. 47
      src/objective-c/GRPCClient/private/GRPCChannel.h
  23. 168
      src/objective-c/GRPCClient/private/GRPCChannel.m
  24. 3
      src/objective-c/GRPCClient/private/GRPCHost.h
  25. 33
      src/objective-c/GRPCClient/private/GRPCHost.m
  26. 55
      src/objective-c/GRPCClient/private/GRPCSecureChannel.h
  27. 118
      src/objective-c/GRPCClient/private/GRPCSecureChannel.m
  28. 2
      src/python/grpcio/commands.py
  29. 2
      src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi
  30. 2
      src/python/grpcio/grpc/_cython/_cygrpc/records.pyx.pxi
  31. 2
      src/python/grpcio/grpc/_cython/cygrpc.pyx
  32. 12
      src/python/grpcio/grpc/_cython/imports.generated.h
  33. 3
      src/ruby/ext/grpc/extconf.rb
  34. 2
      src/ruby/ext/grpc/rb_channel.c
  35. 12
      src/ruby/ext/grpc/rb_grpc_imports.generated.h
  36. 2
      src/ruby/ext/grpc/rb_server_credentials.c
  37. 2
      src/ruby/lib/grpc/version.rb
  38. 1
      templates/grpc.gemspec.template
  39. 35
      templates/src/ruby/lib/grpc/version.rb.template
  40. 6
      test/core/statistics/census_log_tests.c
  41. 4
      test/core/support/sync_test.c
  42. 8
      test/core/support/time_test.c
  43. 2
      test/core/transport/chttp2/timeout_encoding_test.c
  44. 18
      test/core/util/test_config.h
  45. 18
      test/cpp/end2end/thread_stress_test.cc
  46. 34
      test/cpp/qps/client_async.cc
  47. 2
      test/cpp/qps/driver.h
  48. 4
      test/cpp/util/time_test.cc
  49. 2
      test/distrib/csharp/run_distrib_test.sh
  50. 2
      test/distrib/csharp/update_version.sh
  51. 7
      test/distrib/node/run_distrib_test.sh
  52. 29
      test/distrib/python/distribtest.py
  53. 20
      test/distrib/python/run_distrib_test.sh
  54. 21
      third_party/rake-compiler-dock/Dockerfile
  55. 61
      tools/distrib/build_ruby_environment_macos.sh
  56. 1
      tools/dockerfile/distribtest/csharp_centos7_x64/Dockerfile
  57. 2
      tools/dockerfile/distribtest/csharp_jessie_x64/Dockerfile
  58. 2
      tools/dockerfile/distribtest/csharp_jessie_x86/Dockerfile
  59. 2
      tools/dockerfile/distribtest/csharp_ubuntu1404_x64/Dockerfile
  60. 2
      tools/dockerfile/distribtest/csharp_ubuntu1504_x64/Dockerfile
  61. 2
      tools/dockerfile/distribtest/csharp_ubuntu1510_x64/Dockerfile
  62. 2
      tools/dockerfile/distribtest/csharp_ubuntu1604_x64/Dockerfile
  63. 2
      tools/dockerfile/distribtest/csharp_wheezy_x64/Dockerfile
  64. 1
      tools/dockerfile/distribtest/node_centos7_x64/Dockerfile
  65. 2
      tools/dockerfile/distribtest/node_jessie_x64/Dockerfile
  66. 4
      tools/dockerfile/distribtest/node_jessie_x86/Dockerfile
  67. 2
      tools/dockerfile/distribtest/node_ubuntu1204_x64/Dockerfile
  68. 2
      tools/dockerfile/distribtest/node_ubuntu1404_x64/Dockerfile
  69. 2
      tools/dockerfile/distribtest/node_ubuntu1504_x64/Dockerfile
  70. 2
      tools/dockerfile/distribtest/node_ubuntu1510_x64/Dockerfile
  71. 2
      tools/dockerfile/distribtest/node_ubuntu1604_x64/Dockerfile
  72. 6
      tools/dockerfile/distribtest/python_arch_x64/Dockerfile
  73. 3
      tools/dockerfile/distribtest/python_centos6_x64/Dockerfile
  74. 1
      tools/dockerfile/distribtest/python_centos7_x64/Dockerfile
  75. 7
      tools/dockerfile/distribtest/python_fedora20_x64/Dockerfile
  76. 7
      tools/dockerfile/distribtest/python_fedora21_x64/Dockerfile
  77. 7
      tools/dockerfile/distribtest/python_fedora22_x64/Dockerfile
  78. 7
      tools/dockerfile/distribtest/python_fedora23_x64/Dockerfile
  79. 4
      tools/dockerfile/distribtest/python_jessie_x64/Dockerfile
  80. 7
      tools/dockerfile/distribtest/python_jessie_x86/Dockerfile
  81. 2
      tools/dockerfile/distribtest/python_opensuse_x64/Dockerfile
  82. 6
      tools/dockerfile/distribtest/python_ubuntu1204_x64/Dockerfile
  83. 6
      tools/dockerfile/distribtest/python_ubuntu1404_x64/Dockerfile
  84. 6
      tools/dockerfile/distribtest/python_ubuntu1504_x64/Dockerfile
  85. 6
      tools/dockerfile/distribtest/python_ubuntu1510_x64/Dockerfile
  86. 6
      tools/dockerfile/distribtest/python_ubuntu1604_x64/Dockerfile
  87. 4
      tools/dockerfile/distribtest/python_wheezy_x64/Dockerfile
  88. 2
      tools/dockerfile/distribtest/ruby_centos6_x64/Dockerfile
  89. 2
      tools/dockerfile/distribtest/ruby_centos7_x64/Dockerfile
  90. 6
      tools/dockerfile/distribtest/ruby_fedora20_x64/Dockerfile
  91. 6
      tools/dockerfile/distribtest/ruby_fedora21_x64/Dockerfile
  92. 6
      tools/dockerfile/distribtest/ruby_fedora22_x64/Dockerfile
  93. 6
      tools/dockerfile/distribtest/ruby_fedora23_x64/Dockerfile
  94. 5
      tools/dockerfile/distribtest/ruby_jessie_x64/Dockerfile
  95. 5
      tools/dockerfile/distribtest/ruby_jessie_x86/Dockerfile
  96. 2
      tools/dockerfile/distribtest/ruby_opensuse_x64/Dockerfile
  97. 5
      tools/dockerfile/distribtest/ruby_ubuntu1204_x64/Dockerfile
  98. 5
      tools/dockerfile/distribtest/ruby_ubuntu1404_x64/Dockerfile
  99. 5
      tools/dockerfile/distribtest/ruby_ubuntu1504_x64/Dockerfile
  100. 5
      tools/dockerfile/distribtest/ruby_ubuntu1510_x64/Dockerfile
  101. Some files were not shown because too many files have changed in this diff Show More

@ -3,6 +3,7 @@ require 'rake/extensiontask'
require 'rspec/core/rake_task'
require 'rubocop/rake_task'
require 'bundler/gem_tasks'
require 'fileutils'
load 'tools/distrib/docker_for_windows.rb'
@ -23,7 +24,11 @@ Rake::ExtensionTask.new('grpc_c', spec) do |ext|
ext.ext_dir = File.join('src', 'ruby', 'ext', 'grpc')
ext.lib_dir = File.join('src', 'ruby', 'lib', 'grpc')
ext.cross_compile = true
ext.cross_platform = ['x86-mingw32', 'x64-mingw32']
ext.cross_platform = [
'x86-mingw32', 'x64-mingw32',
'x86_64-linux', 'x86-linux',
'universal-darwin'
]
ext.cross_compiling do |spec|
spec.files = %w( etc/roots.pem grpc_c.32.ruby grpc_c.64.ruby )
spec.files += Dir.glob('src/ruby/bin/**/*')
@ -91,11 +96,18 @@ task 'dlls' do
end
desc 'Build the gem file under rake_compiler_dock'
task 'gem:windows' do
desc 'Build the native gem file under rake_compiler_dock'
task 'gem:native' do
verbose = ENV['V'] || '0'
docker_for_windows "bundle && rake cross native gem RUBY_CC_VERSION=2.3.0:2.2.2:2.1.6:2.0.0 V=#{verbose}"
if RUBY_PLATFORM =~ /darwin/
FileUtils.touch 'grpc_c.32.ruby'
FileUtils.touch 'grpc_c.64.ruby'
system "rake cross native gem RUBY_CC_VERSION=2.3.0:2.2.2:2.1.5:2.0.0 V=#{verbose}"
else
Rake::Task['dlls'].execute
docker_for_windows "bundle && rake cross native gem RUBY_CC_VERSION=2.3.0:2.2.2:2.1.5:2.0.0 V=#{verbose}"
end
end
# Define dependencies between the suites.
@ -105,8 +117,6 @@ task 'suite:bidi' => 'suite:wrapper'
task 'suite:server' => 'suite:wrapper'
task 'suite:pb' => 'suite:server'
task 'gem:windows' => 'dlls'
desc 'Compiles the gRPC extension then runs all the tests'
task all: ['suite:idiomatic', 'suite:bidi', 'suite:pb', 'suite:server']
task default: :all

@ -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
@ -33,7 +33,7 @@
var PROTO_PATH = __dirname + '/helloworld.proto';
var grpc = require('../../');
var grpc = require('grpc');
var hello_proto = grpc.load(PROTO_PATH).helloworld;
function main() {

@ -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
@ -33,7 +33,7 @@
var PROTO_PATH = __dirname + '/helloworld.proto';
var grpc = require('../../');
var grpc = require('grpc');
var hello_proto = grpc.load(PROTO_PATH).helloworld;
/**

@ -0,0 +1,7 @@
{
"name": "grpc-examples",
"version": "0.1.0",
"dependencies": {
"grpc": "0.12.0"
}
}

@ -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
@ -30,13 +30,13 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
var async = require('async');
var fs = require('fs');
var parseArgs = require('minimist');
var path = require('path');
var _ = require('lodash');
var grpc = require('../../../');
var grpc = require('grpc');
var routeguide = grpc.load(__dirname + '/route_guide.proto').routeguide;
var client = new routeguide.RouteGuide('localhost:50051',
grpc.Credentials.createInsecure());

@ -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
@ -30,12 +30,12 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
var fs = require('fs');
var parseArgs = require('minimist');
var path = require('path');
var _ = require('lodash');
var grpc = require('../../../');
var grpc = require('grpc');
var routeguide = grpc.load(__dirname + '/route_guide.proto').routeguide;
var COORD_FACTOR = 1e7;

@ -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
@ -34,6 +34,7 @@
#import <UIKit/UIKit.h>
#import "AppDelegate.h"
#import <GRPCClient/GRPCCall+ChannelArg.h>
#import <GRPCClient/GRPCCall+Tests.h>
#import <HelloWorld/Helloworld.pbrpc.h>
@ -42,6 +43,7 @@ static NSString * const kHostAddress = @"localhost:50051";
int main(int argc, char * argv[]) {
@autoreleasepool {
[GRPCCall useInsecureConnectionsForHost:kHostAddress];
[GRPCCall setUserAgentPrefix:@"HelloWorld/1.0" forHost:kHostAddress];
HLWGreeter *client = [[HLWGreeter alloc] initWithHost:kHostAddress];

@ -14,7 +14,6 @@ Gem::Specification.new do |s|
s.license = 'BSD-3-Clause'
s.required_ruby_version = '>= 2.0.0'
s.requirements << 'libgrpc ~> 0.11.0 needs to be installed'
s.files = %w( Makefile )
s.files += %w( etc/roots.pem )

@ -115,7 +115,8 @@ GPR_API void gpr_cv_destroy(gpr_cv *cv);
/* Atomically release *mu and wait on *cv. When the calling thread is woken
from *cv or the deadline abs_deadline is exceeded, execute gpr_mu_lock(mu)
and return whether the deadline was exceeded. Use
abs_deadline==gpr_inf_future for no deadline. May return even when not
abs_deadline==gpr_inf_future for no deadline. abs_deadline can be either
an absolute deadline, or a GPR_TIMESPAN. May return even when not
woken explicitly. Requires: *mu and *cv initialized; the calling thread
holds an exclusive lock on *mu. */
GPR_API int gpr_cv_wait(gpr_cv *cv, gpr_mu *mu, gpr_timespec abs_deadline);

@ -102,14 +102,16 @@ GPR_API gpr_timespec gpr_time_min(gpr_timespec a, gpr_timespec b);
GPR_API gpr_timespec gpr_time_add(gpr_timespec a, gpr_timespec b);
GPR_API gpr_timespec gpr_time_sub(gpr_timespec a, gpr_timespec b);
/* Return a timespec representing a given number of time units. LONG_MIN is
interpreted as gpr_inf_past, and LONG_MAX as gpr_inf_future. */
GPR_API gpr_timespec gpr_time_from_micros(long x, gpr_clock_type clock_type);
GPR_API gpr_timespec gpr_time_from_nanos(long x, gpr_clock_type clock_type);
GPR_API gpr_timespec gpr_time_from_millis(long x, gpr_clock_type clock_type);
GPR_API gpr_timespec gpr_time_from_seconds(long x, gpr_clock_type clock_type);
GPR_API gpr_timespec gpr_time_from_minutes(long x, gpr_clock_type clock_type);
GPR_API gpr_timespec gpr_time_from_hours(long x, gpr_clock_type clock_type);
/* Return a timespec representing a given number of time units. INT64_MIN is
interpreted as gpr_inf_past, and INT64_MAX as gpr_inf_future. */
GPR_API gpr_timespec gpr_time_from_micros(int64_t x, gpr_clock_type clock_type);
GPR_API gpr_timespec gpr_time_from_nanos(int64_t x, gpr_clock_type clock_type);
GPR_API gpr_timespec gpr_time_from_millis(int64_t x, gpr_clock_type clock_type);
GPR_API gpr_timespec
gpr_time_from_seconds(int64_t x, gpr_clock_type clock_type);
GPR_API gpr_timespec
gpr_time_from_minutes(int64_t x, gpr_clock_type clock_type);
GPR_API gpr_timespec gpr_time_from_hours(int64_t x, gpr_clock_type clock_type);
GPR_API int32_t gpr_time_to_millis(gpr_timespec timespec);

@ -118,6 +118,8 @@ def cython_extensions(package_names, module_names, extra_sources, include_dirs,
sources=[module_file] + extra_sources,
include_dirs=include_dirs, libraries=libraries,
define_macros=define_macros,
extra_compile_args=list(CFLAGS),
extra_link_args=list(LDFLAGS),
) for (module_name, module_file) in zip(module_names, module_files)
]
if build_with_cython:
@ -216,7 +218,7 @@ else:
setuptools.setup(
name='grpcio',
version='0.12.0b8',
version='0.12.0b9',
license=LICENSE,
ext_modules=CYTHON_EXTENSION_MODULES,
packages=list(PACKAGES),

@ -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;
}

@ -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;
}

@ -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);

@ -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

@ -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 =

@ -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;

@ -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)) {

@ -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
@ -32,6 +32,7 @@
*/
#include <limits>
#include <cstdint>
#include "grpc/grpc.h"
#include "grpc/support/time.h"
@ -46,7 +47,7 @@ gpr_timespec MillisecondsToTimespec(double millis) {
} else if (millis == -std::numeric_limits<double>::infinity()) {
return gpr_inf_past(GPR_CLOCK_REALTIME);
} else {
return gpr_time_from_micros(static_cast<long>(millis * 1000),
return gpr_time_from_micros(static_cast<int64_t>(millis * 1000),
GPR_CLOCK_REALTIME);
}
}

@ -1,6 +1,6 @@
/*
*
* Copyright 2015, Google Inc.
* Copyright 2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -30,9 +30,17 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#import "GRPCCall.h"
#import "GRPCChannel.h"
/**
* Methods to configure GRPC channel options.
*/
@interface GRPCCall (ChannelArg)
/**
* Use the provided @c userAgentPrefix at the beginning of the HTTP User Agent string for all calls
* to the specified @c host.
*/
+ (void)setUserAgentPrefix:(NSString *)userAgentPrefix forHost:(NSString *)host;
@interface GRPCUnsecuredChannel : GRPCChannel
- (instancetype)initWithHost:(NSString *)host NS_DESIGNATED_INITIALIZER;
@end

@ -1,6 +1,6 @@
/*
*
* Copyright 2015, Google Inc.
* Copyright 2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -31,20 +31,19 @@
*
*/
#import "GRPCUnsecuredChannel.h"
#import "GRPCCall+ChannelArg.h"
#include <grpc/grpc.h>
#import "private/GRPCHost.h"
@implementation GRPCUnsecuredChannel
@implementation GRPCCall (ChannelArg)
- (instancetype)initWithHost:(NSString *)host {
return (self = [super initWithChannel:grpc_insecure_channel_create(host.UTF8String, NULL, NULL)]);
+ (void)setUserAgentPrefix:(NSString *)userAgentPrefix forHost:(NSString *)host {
if (!host) {
[NSException raise:NSInvalidArgumentException
format:@"host and userAgentPrefix must be provided."];
}
GRPCHost *hostConfig = [GRPCHost hostWithAddress:host];
hostConfig.userAgentPrefix = userAgentPrefix;
}
// TODO(jcanizales): GRPCSecureChannel and GRPCUnsecuredChannel are just convenience initializers
// for GRPCChannel. Move them into GRPCChannel, which will make the following unnecessary.
- (instancetype)initWithChannel:(grpc_channel *)unmanagedChannel {
[NSException raise:NSInternalInconsistencyException format:@"use the other initializer"];
return [self initWithHost:nil]; // silence warnings
}
@end

@ -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
@ -33,18 +33,51 @@
#import <Foundation/Foundation.h>
struct grpc_channel;
#include <grpc/grpc.h>
struct grpc_channel_credentials;
/**
* Each separate instance of this class represents at least one TCP connection to the provided host.
* Create them using one of the subclasses |GRPCSecureChannel| and |GRPCUnsecuredChannel|.
*/
@interface GRPCChannel : NSObject
@property(nonatomic, readonly) struct grpc_channel *unmanagedChannel;
@property(nonatomic, readonly, nonnull) struct grpc_channel *unmanagedChannel;
- (nullable instancetype)init NS_UNAVAILABLE;
/**
* This initializer takes ownership of the passed channel, and will destroy it when this object is
* deallocated. It's illegal to pass the same grpc_channel to two different GRPCChannel objects.
* Creates a secure channel to the specified @c host using default credentials and channel
* arguments. If certificates could not be found to create a secure channel, then @c nil is
* returned.
*/
- (instancetype)initWithChannel:(struct grpc_channel *)unmanagedChannel NS_DESIGNATED_INITIALIZER;
+ (nullable GRPCChannel *)secureChannelWithHost:(nonnull NSString *)host;
/**
* Creates a secure channel to the specified @c host using the specified @c pathToCertificates and
* @c channelArgs. Only in tests should @c pathToCertificates be nil or
* @c GRPC_SSL_TARGET_NAME_OVERRIDE_ARG channel arg be set. Passing nil for @c pathToCertificates
* results in using the default root certificates distributed with the library. If certificates
* could not be found in any case, then @c nil is returned.
*/
+ (nullable GRPCChannel *)secureChannelWithHost:(nonnull NSString *)host
pathToCertificates:(nullable NSString *)pathToCertificates
channelArgs:(nullable NSDictionary *)channelArgs;
/**
* Creates a secure channel to the specified @c host using the specified @c credentials and
* @c channelArgs. Only in tests should @c GRPC_SSL_TARGET_NAME_OVERRIDE_ARG channel arg be set.
*/
+ (nonnull GRPCChannel *)secureChannelWithHost:(nonnull NSString *)host
credentials:(nonnull struct grpc_channel_credentials *)credentials
channelArgs:(nullable NSDictionary *)channelArgs;
/**
* Creates an insecure channel to the specified @c host using the specified @c channelArgs.
*/
+ (nonnull GRPCChannel *)insecureChannelWithHost:(nonnull NSString *)host
channelArgs:(nullable NSDictionary *)channelArgs;
@end

@ -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
@ -33,22 +33,114 @@
#import "GRPCChannel.h"
#include <grpc/grpc.h>
#include <grpc/grpc_security.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
@implementation GRPCChannel
/**
* Returns @c grpc_channel_credentials from the specified @c path. If the file at the path could not
* be read then NULL is returned. If NULL is returned, @c errorPtr may not be NULL if there are
* details available describing what went wrong.
*/
static grpc_channel_credentials *CertificatesAtPath(NSString *path, NSError **errorPtr) {
// Files in PEM format can have non-ASCII characters in their comments (e.g. for the name of the
// issuer). Load them as UTF8 and produce an ASCII equivalent.
NSString *contentInUTF8 = [NSString stringWithContentsOfFile:path
encoding:NSUTF8StringEncoding
error:errorPtr];
NSData *contentInASCII = [contentInUTF8 dataUsingEncoding:NSASCIIStringEncoding
allowLossyConversion:YES];
if (!contentInASCII.bytes) {
// Passing NULL to grpc_ssl_credentials_create produces behavior we don't want, so return.
return NULL;
}
return grpc_ssl_credentials_create(contentInASCII.bytes, NULL, NULL);
}
void freeChannelArgs(grpc_channel_args *channel_args) {
for (size_t i = 0; i < channel_args->num_args; ++i) {
grpc_arg *arg = &channel_args->args[i];
gpr_free(arg->key);
if (arg->type == GRPC_ARG_STRING) {
gpr_free(arg->value.string);
}
}
gpr_free(channel_args);
}
/**
* Allocates a @c grpc_channel_args and populates it with the options specified in the
* @c dictionary. Keys must be @c NSString. If the value responds to @c @selector(UTF8String) then
* it will be mapped to @c GRPC_ARG_STRING. If not, it will be mapped to @c GRPC_ARG_INTEGER if the
* value responds to @c @selector(intValue). Otherwise, an exception will be raised. The caller of
* this function is responsible for calling @c freeChannelArgs on a non-NULL returned value.
*/
grpc_channel_args * buildChannelArgs(NSDictionary *dictionary) {
if (!dictionary) {
return NULL;
}
- (instancetype)init {
return [self initWithChannel:NULL];
NSArray *keys = [dictionary allKeys];
NSUInteger argCount = [keys count];
grpc_channel_args *channelArgs = gpr_malloc(sizeof(grpc_channel_args));
channelArgs->num_args = argCount;
channelArgs->args = gpr_malloc(argCount * sizeof(grpc_arg));
// TODO(kriswuollett) Check that keys adhere to GRPC core library requirements
for (NSUInteger i = 0; i < argCount; ++i) {
grpc_arg *arg = &channelArgs->args[i];
arg->key = gpr_strdup([keys[i] UTF8String]);
id value = dictionary[keys[i]];
if ([value respondsToSelector:@selector(UTF8String)]) {
arg->type = GRPC_ARG_STRING;
arg->value.string = gpr_strdup([value UTF8String]);
} else if ([value respondsToSelector:@selector(intValue)]) {
arg->type = GRPC_ARG_INTEGER;
arg->value.integer = [value intValue];
} else {
[NSException raise:NSInvalidArgumentException
format:@"Invalid value type: %@", [value class]];
}
}
return channelArgs;
}
@implementation GRPCChannel {
// Retain arguments to channel_create because they may not be used on the thread that invoked
// the channel_create function.
NSString *_host;
grpc_channel_args *_channelArgs;
}
// Designated initializer
- (instancetype)initWithChannel:(grpc_channel *)unmanagedChannel {
if (!unmanagedChannel) {
- (instancetype)initWithHost:(NSString *)host
secure:(BOOL)secure
credentials:(struct grpc_channel_credentials *)credentials
channelArgs:(NSDictionary *)channelArgs {
if (!host) {
[NSException raise:NSInvalidArgumentException format:@"host argument missing"];
}
if (secure && !credentials) {
return nil;
}
if ((self = [super init])) {
_unmanagedChannel = unmanagedChannel;
if (self = [super init]) {
_channelArgs = buildChannelArgs(channelArgs);
_host = [host copy];
if (secure) {
_unmanagedChannel = grpc_secure_channel_create(credentials, _host.UTF8String, _channelArgs,
NULL);
} else {
_unmanagedChannel = grpc_insecure_channel_create(_host.UTF8String, _channelArgs, NULL);
}
}
return self;
}
@ -56,5 +148,61 @@
// TODO(jcanizales): Be sure to add a test with a server that closes the connection prematurely,
// as in the past that made this call to crash.
grpc_channel_destroy(_unmanagedChannel);
freeChannelArgs(_channelArgs);
}
+ (GRPCChannel *)secureChannelWithHost:(NSString *)host {
return [[GRPCChannel alloc] initWithHost:host secure:YES credentials:NULL channelArgs:NULL];
}
+ (GRPCChannel *)secureChannelWithHost:(NSString *)host
pathToCertificates:(NSString *)path
channelArgs:(NSDictionary *)channelArgs {
// Load default SSL certificates once.
static grpc_channel_credentials *kDefaultCertificates;
static dispatch_once_t loading;
dispatch_once(&loading, ^{
NSString *defaultPath = @"gRPCCertificates.bundle/roots"; // .pem
// Do not use NSBundle.mainBundle, as it's nil for tests of library projects.
NSBundle *bundle = [NSBundle bundleForClass:self.class];
NSString *path = [bundle pathForResource:defaultPath ofType:@"pem"];
NSError *error;
kDefaultCertificates = CertificatesAtPath(path, &error);
NSAssert(kDefaultCertificates, @"Could not read %@/%@.pem. This file, with the root "
"certificates, is needed to establish secure (TLS) connections. Because the file is "
"distributed with the gRPC library, this error is usually a sign that the library "
"wasn't configured correctly for your project. Error: %@",
bundle.bundlePath, defaultPath, error);
});
//TODO(jcanizales): Add NSError** parameter to the initializer.
grpc_channel_credentials *certificates = path
? CertificatesAtPath(path, NULL)
: kDefaultCertificates;
return [[GRPCChannel alloc] initWithHost:host
secure:YES
credentials:certificates
channelArgs:channelArgs];
}
+ (GRPCChannel *)secureChannelWithHost:(NSString *)host
credentials:(struct grpc_channel_credentials *)credentials
channelArgs:(NSDictionary *)channelArgs {
return [[GRPCChannel alloc] initWithHost:host
secure:YES
credentials:credentials
channelArgs:channelArgs];
}
+ (GRPCChannel *)insecureChannelWithHost:(NSString *)host
channelArgs:(NSDictionary *)channelArgs {
return [[GRPCChannel alloc] initWithHost:host
secure:NO
credentials:NULL
channelArgs:channelArgs];
}
@end

@ -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
@ -39,6 +39,7 @@ struct grpc_call;
@interface GRPCHost : NSObject
@property(nonatomic, readonly) NSString *address;
@property(nonatomic, copy) NSString *userAgentPrefix;
/** The following properties should only be modified for testing: */

@ -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
@ -34,11 +34,15 @@
#import "GRPCHost.h"
#include <grpc/grpc.h>
#import <GRPCClient/GRPCCall+ChannelArg.h>
#import "GRPCChannel.h"
#import "GRPCCompletionQueue.h"
#import "GRPCSecureChannel.h"
#import "GRPCUnsecuredChannel.h"
#import "NSDictionary+GRPC.h"
// TODO(jcanizales): Generate the version in a standalone header, from templates. Like
// templates/src/core/surface/version.c.template .
#define GRPC_OBJC_VERSION_STRING @"0.13.0"
@interface GRPCHost ()
// TODO(mlumish): Investigate whether caching channels with strong links is a good idea.
@ -106,13 +110,28 @@
- (GRPCChannel *)channel {
// Create it lazily, because we don't want to open a connection just because someone is
// configuring a host.
if (!_channel) {
NSMutableDictionary *args = [NSMutableDictionary dictionary];
// TODO(jcanizales): Add OS and device information (see
// https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md#user-agents ).
NSString *userAgent = @"grpc-objc/" GRPC_OBJC_VERSION_STRING;
if (_userAgentPrefix) {
userAgent = [@[_userAgentPrefix, userAgent] componentsJoinedByString:@" "];
}
args[@GRPC_ARG_PRIMARY_USER_AGENT_STRING] = userAgent;
if (_secure) {
_channel = [[GRPCSecureChannel alloc] initWithHost:_address
pathToCertificates:_pathToCertificates
hostNameOverride:_hostNameOverride];
if (_hostNameOverride) {
args[@GRPC_SSL_TARGET_NAME_OVERRIDE_ARG] = _hostNameOverride;
}
_channel = [GRPCChannel secureChannelWithHost:_address
pathToCertificates:_pathToCertificates
channelArgs:args];
} else {
_channel = [[GRPCUnsecuredChannel alloc] initWithHost:_address];
_channel = [GRPCChannel insecureChannelWithHost:_address channelArgs:args];
}
}
return _channel;

@ -1,55 +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.
*
*/
#include <grpc/grpc.h>
#import "GRPCChannel.h"
struct grpc_channel_credentials;
@interface GRPCSecureChannel : GRPCChannel
- (instancetype)initWithHost:(NSString *)host;
/**
* Only in tests shouldn't pathToCertificates or hostNameOverride be nil. Passing nil for
* pathToCertificates results in using the default root certificates distributed with the library.
*/
- (instancetype)initWithHost:(NSString *)host
pathToCertificates:(NSString *)path
hostNameOverride:(NSString *)hostNameOverride;
/** The passed arguments aren't required to be valid beyond the invocation of this initializer. */
- (instancetype)initWithHost:(NSString *)host
credentials:(struct grpc_channel_credentials *)credentials
args:(grpc_channel_args *)args NS_DESIGNATED_INITIALIZER;
@end

@ -1,118 +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.
*
*/
#import "GRPCSecureChannel.h"
#include <grpc/grpc_security.h>
// Returns NULL if the file at path couldn't be read. In that case, if errorPtr isn't NULL,
// *errorPtr will be an object describing what went wrong.
static grpc_channel_credentials *CertificatesAtPath(NSString *path, NSError **errorPtr) {
// Files in PEM format can have non-ASCII characters in their comments (e.g. for the name of the
// issuer). Load them as UTF8 and produce an ASCII equivalent.
NSString *contentInUTF8 = [NSString stringWithContentsOfFile:path
encoding:NSUTF8StringEncoding
error:errorPtr];
NSData *contentInASCII = [contentInUTF8 dataUsingEncoding:NSASCIIStringEncoding
allowLossyConversion:YES];
if (!contentInASCII.bytes) {
// Passing NULL to grpc_ssl_credentials_create produces behavior we don't want, so return.
return NULL;
}
return grpc_ssl_credentials_create(contentInASCII.bytes, NULL, NULL);
}
@implementation GRPCSecureChannel
- (instancetype)initWithHost:(NSString *)host {
return [self initWithHost:host pathToCertificates:nil hostNameOverride:nil];
}
- (instancetype)initWithHost:(NSString *)host
pathToCertificates:(NSString *)path
hostNameOverride:(NSString *)hostNameOverride {
// Load default SSL certificates once.
static grpc_channel_credentials *kDefaultCertificates;
static dispatch_once_t loading;
dispatch_once(&loading, ^{
NSString *defaultPath = @"gRPCCertificates.bundle/roots"; // .pem
// Do not use NSBundle.mainBundle, as it's nil for tests of library projects.
NSBundle *bundle = [NSBundle bundleForClass:self.class];
NSString *path = [bundle pathForResource:defaultPath ofType:@"pem"];
NSError *error;
kDefaultCertificates = CertificatesAtPath(path, &error);
NSAssert(kDefaultCertificates, @"Could not read %@/%@.pem. This file, with the root "
"certificates, is needed to establish secure (TLS) connections. Because the file is "
"distributed with the gRPC library, this error is usually a sign that the library "
"wasn't configured correctly for your project. Error: %@",
bundle.bundlePath, defaultPath, error);
});
//TODO(jcanizales): Add NSError** parameter to the initializer.
grpc_channel_credentials *certificates = path
? CertificatesAtPath(path, NULL)
: kDefaultCertificates;
if (!certificates) {
return nil;
}
// Ritual to pass the SSL host name override to the C library.
grpc_channel_args channelArgs;
grpc_arg nameOverrideArg;
channelArgs.num_args = 1;
channelArgs.args = &nameOverrideArg;
nameOverrideArg.type = GRPC_ARG_STRING;
nameOverrideArg.key = GRPC_SSL_TARGET_NAME_OVERRIDE_ARG;
// Cast const away. Hope C gRPC doesn't modify it!
nameOverrideArg.value.string = (char *) hostNameOverride.UTF8String;
grpc_channel_args *args = hostNameOverride ? &channelArgs : NULL;
return [self initWithHost:host credentials:certificates args:args];
}
- (instancetype)initWithHost:(NSString *)host
credentials:(grpc_channel_credentials *)credentials
args:(grpc_channel_args *)args {
return (self = [super
initWithChannel:grpc_secure_channel_create(
credentials, host.UTF8String, args, NULL)]);
}
// TODO(jcanizales): GRPCSecureChannel and GRPCUnsecuredChannel are just convenience initializers
// for GRPCChannel. Move them into GRPCChannel, which will make the following unnecessary.
- (instancetype)initWithChannel:(grpc_channel *)unmanagedChannel {
[NSException raise:NSInternalInconsistencyException format:@"use another initializer"];
return [self initWithHost:nil]; // silence warnings
}
@end

@ -135,7 +135,7 @@ class Install(install.install, EggNameMixin):
def initialize_options(self):
install.install.initialize_options(self)
self.use_grpc_custom_bdist = False
self.use_grpc_custom_bdist = bool(int(os.environ.get('GRPC_PYTHON_USE_CUSTOM_BDIST', '1')))
def finalize_options(self):
install.install.finalize_options(self)

@ -1,4 +1,4 @@
# Copyright 2015, Google Inc.
# Copyright 2015-2016, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without

@ -1,4 +1,4 @@
# Copyright 2015, Google Inc.
# Copyright 2015-2016, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without

@ -1,4 +1,4 @@
# Copyright 2015, Google Inc.
# Copyright 2015-2016, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without

@ -655,22 +655,22 @@ extern gpr_time_add_type gpr_time_add_import;
typedef gpr_timespec(*gpr_time_sub_type)(gpr_timespec a, gpr_timespec b);
extern gpr_time_sub_type gpr_time_sub_import;
#define gpr_time_sub gpr_time_sub_import
typedef gpr_timespec(*gpr_time_from_micros_type)(long x, gpr_clock_type clock_type);
typedef gpr_timespec(*gpr_time_from_micros_type)(int64_t x, gpr_clock_type clock_type);
extern gpr_time_from_micros_type gpr_time_from_micros_import;
#define gpr_time_from_micros gpr_time_from_micros_import
typedef gpr_timespec(*gpr_time_from_nanos_type)(long x, gpr_clock_type clock_type);
typedef gpr_timespec(*gpr_time_from_nanos_type)(int64_t x, gpr_clock_type clock_type);
extern gpr_time_from_nanos_type gpr_time_from_nanos_import;
#define gpr_time_from_nanos gpr_time_from_nanos_import
typedef gpr_timespec(*gpr_time_from_millis_type)(long x, gpr_clock_type clock_type);
typedef gpr_timespec(*gpr_time_from_millis_type)(int64_t x, gpr_clock_type clock_type);
extern gpr_time_from_millis_type gpr_time_from_millis_import;
#define gpr_time_from_millis gpr_time_from_millis_import
typedef gpr_timespec(*gpr_time_from_seconds_type)(long x, gpr_clock_type clock_type);
typedef gpr_timespec(*gpr_time_from_seconds_type)(int64_t x, gpr_clock_type clock_type);
extern gpr_time_from_seconds_type gpr_time_from_seconds_import;
#define gpr_time_from_seconds gpr_time_from_seconds_import
typedef gpr_timespec(*gpr_time_from_minutes_type)(long x, gpr_clock_type clock_type);
typedef gpr_timespec(*gpr_time_from_minutes_type)(int64_t x, gpr_clock_type clock_type);
extern gpr_time_from_minutes_type gpr_time_from_minutes_import;
#define gpr_time_from_minutes gpr_time_from_minutes_import
typedef gpr_timespec(*gpr_time_from_hours_type)(long x, gpr_clock_type clock_type);
typedef gpr_timespec(*gpr_time_from_hours_type)(int64_t x, gpr_clock_type clock_type);
extern gpr_time_from_hours_type gpr_time_from_hours_import;
#define gpr_time_from_hours gpr_time_from_hours_import
typedef int32_t(*gpr_time_to_millis_type)(gpr_timespec timespec);

@ -66,6 +66,8 @@ else
grpc_lib_dir = File.join(grpc_root, 'libs', grpc_config)
end
ENV['MACOSX_DEPLOYMENT_TARGET'] = '10.7'
unless File.exist?(File.join(grpc_lib_dir, 'libgrpc.a')) or windows
ENV['AR'] = RbConfig::CONFIG['AR'] + ' rcs'
ENV['CC'] = RbConfig::CONFIG['CC']
@ -75,6 +77,7 @@ unless File.exist?(File.join(grpc_lib_dir, 'libgrpc.a')) or windows
ENV['EMBED_OPENSSL'] = 'true'
ENV['EMBED_ZLIB'] = 'true'
ENV['ARCH_FLAGS'] = RbConfig::CONFIG['ARCH_FLAG']
ENV['ARCH_FLAGS'] = '-arch i386 -arch x86_64' if RUBY_PLATFORM =~ /darwin/
output_dir = File.expand_path(RbConfig::CONFIG['topdir'])

@ -229,7 +229,7 @@ static VALUE grpc_rb_channel_watch_connectivity_state(VALUE self,
}
grpc_channel_watch_connectivity_state(
ch,
NUM2LONG(last_state),
(grpc_connectivity_state)NUM2LONG(last_state),
grpc_rb_time_timeval(deadline, /* absolute time */ 0),
cq,
ROBJECT(tag));

@ -655,22 +655,22 @@ extern gpr_time_add_type gpr_time_add_import;
typedef gpr_timespec(*gpr_time_sub_type)(gpr_timespec a, gpr_timespec b);
extern gpr_time_sub_type gpr_time_sub_import;
#define gpr_time_sub gpr_time_sub_import
typedef gpr_timespec(*gpr_time_from_micros_type)(long x, gpr_clock_type clock_type);
typedef gpr_timespec(*gpr_time_from_micros_type)(int64_t x, gpr_clock_type clock_type);
extern gpr_time_from_micros_type gpr_time_from_micros_import;
#define gpr_time_from_micros gpr_time_from_micros_import
typedef gpr_timespec(*gpr_time_from_nanos_type)(long x, gpr_clock_type clock_type);
typedef gpr_timespec(*gpr_time_from_nanos_type)(int64_t x, gpr_clock_type clock_type);
extern gpr_time_from_nanos_type gpr_time_from_nanos_import;
#define gpr_time_from_nanos gpr_time_from_nanos_import
typedef gpr_timespec(*gpr_time_from_millis_type)(long x, gpr_clock_type clock_type);
typedef gpr_timespec(*gpr_time_from_millis_type)(int64_t x, gpr_clock_type clock_type);
extern gpr_time_from_millis_type gpr_time_from_millis_import;
#define gpr_time_from_millis gpr_time_from_millis_import
typedef gpr_timespec(*gpr_time_from_seconds_type)(long x, gpr_clock_type clock_type);
typedef gpr_timespec(*gpr_time_from_seconds_type)(int64_t x, gpr_clock_type clock_type);
extern gpr_time_from_seconds_type gpr_time_from_seconds_import;
#define gpr_time_from_seconds gpr_time_from_seconds_import
typedef gpr_timespec(*gpr_time_from_minutes_type)(long x, gpr_clock_type clock_type);
typedef gpr_timespec(*gpr_time_from_minutes_type)(int64_t x, gpr_clock_type clock_type);
extern gpr_time_from_minutes_type gpr_time_from_minutes_import;
#define gpr_time_from_minutes gpr_time_from_minutes_import
typedef gpr_timespec(*gpr_time_from_hours_type)(long x, gpr_clock_type clock_type);
typedef gpr_timespec(*gpr_time_from_hours_type)(int64_t x, gpr_clock_type clock_type);
extern gpr_time_from_hours_type gpr_time_from_hours_import;
#define gpr_time_from_hours gpr_time_from_hours_import
typedef int32_t(*gpr_time_to_millis_type)(gpr_timespec timespec);

@ -177,7 +177,7 @@ static VALUE grpc_rb_server_credentials_init(VALUE self, VALUE pem_root_certs,
VALUE key = Qnil;
VALUE key_cert = Qnil;
int auth_client = 0;
int num_key_certs = 0;
long num_key_certs = 0;
int i;
if (NIL_P(force_client_auth) ||

@ -29,5 +29,5 @@
# GRPC contains the General RPC module.
module GRPC
VERSION = '0.12.0'
VERSION = '0.13.0.0'
end

@ -16,7 +16,6 @@
s.license = 'BSD-3-Clause'
s.required_ruby_version = '>= 2.0.0'
s.requirements << 'libgrpc ~> 0.11.0 needs to be installed'
s.files = %w( Makefile )
s.files += %w( etc/roots.pem )

@ -0,0 +1,35 @@
%YAML 1.2
--- |
# Copyright 2015-2016, 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.
# GRPC contains the General RPC module.
module GRPC
VERSION = '${settings.version.major}.${settings.version.minor}.${settings.version.micro}.${settings.version.build}'
end

@ -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
@ -237,8 +237,8 @@ static void reader_thread(void *arg) {
gpr_timespec interval;
int counter = 0;
printf(" Reader starting\n");
interval = gpr_time_from_micros(args->read_iteration_interval_in_msec * 1000,
GPR_TIMESPAN);
interval = gpr_time_from_micros(
(int64_t)args->read_iteration_interval_in_msec * 1000, GPR_TIMESPAN);
gpr_mu_lock(args->mu);
while (!args->stop_flag && records_read < args->total_records) {
gpr_cv_wait(&args->stop, args->mu, interval);

@ -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
@ -251,7 +251,7 @@ static void test(const char *name, void (*body)(void *m),
gpr_timespec start = gpr_now(GPR_CLOCK_REALTIME);
gpr_timespec time_taken;
gpr_timespec deadline = gpr_time_add(
start, gpr_time_from_micros(timeout_s * 1000000, GPR_TIMESPAN));
start, gpr_time_from_micros((int64_t)timeout_s * 1000000, GPR_TIMESPAN));
fprintf(stderr, "%s:", name);
while (gpr_time_cmp(gpr_now(GPR_CLOCK_REALTIME), deadline) < 0) {
iterations <<= 1;

@ -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
@ -125,15 +125,15 @@ static void test_values(void) {
}
/* Test possible overflow in conversion of -ve values. */
x = gpr_time_from_micros(-(LONG_MAX - 999997), GPR_TIMESPAN);
x = gpr_time_from_micros(-(INT64_MAX - 999997), GPR_TIMESPAN);
GPR_ASSERT(x.tv_sec < 0);
GPR_ASSERT(x.tv_nsec >= 0 && x.tv_nsec < GPR_NS_PER_SEC);
x = gpr_time_from_nanos(-(LONG_MAX - 999999997), GPR_TIMESPAN);
x = gpr_time_from_nanos(-(INT64_MAX - 999999997), GPR_TIMESPAN);
GPR_ASSERT(x.tv_sec < 0);
GPR_ASSERT(x.tv_nsec >= 0 && x.tv_nsec < GPR_NS_PER_SEC);
x = gpr_time_from_millis(-(LONG_MAX - 997), GPR_TIMESPAN);
x = gpr_time_from_millis(-(INT64_MAX - 997), GPR_TIMESPAN);
GPR_ASSERT(x.tv_sec < 0);
GPR_ASSERT(x.tv_nsec >= 0 && x.tv_nsec < GPR_NS_PER_SEC);

@ -93,7 +93,7 @@ static void assert_decodes_as(const char *buffer, gpr_timespec expected) {
}
void decode_suite(char ext,
gpr_timespec (*answer)(long x, gpr_clock_type clock)) {
gpr_timespec (*answer)(int64_t x, gpr_clock_type clock)) {
long test_vals[] = {1, 12, 123, 1234, 12345, 123456,
1234567, 12345678, 123456789, 98765432, 9876543, 987654,
98765, 9876, 987, 98, 9};

@ -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
@ -54,16 +54,16 @@ extern double g_fixture_slowdown_factor;
(GRPC_TEST_SLOWDOWN_BUILD_FACTOR * GRPC_TEST_SLOWDOWN_MACHINE_FACTOR * \
g_fixture_slowdown_factor)
#define GRPC_TIMEOUT_SECONDS_TO_DEADLINE(x) \
gpr_time_add( \
gpr_now(GPR_CLOCK_MONOTONIC), \
gpr_time_from_millis((long)(GRPC_TEST_SLOWDOWN_FACTOR * 1e3 * (x)), \
#define GRPC_TIMEOUT_SECONDS_TO_DEADLINE(x) \
gpr_time_add( \
gpr_now(GPR_CLOCK_MONOTONIC), \
gpr_time_from_millis((int64_t)(GRPC_TEST_SLOWDOWN_FACTOR * 1e3 * (x)), \
GPR_TIMESPAN))
#define GRPC_TIMEOUT_MILLIS_TO_DEADLINE(x) \
gpr_time_add( \
gpr_now(GPR_CLOCK_MONOTONIC), \
gpr_time_from_micros((long)(GRPC_TEST_SLOWDOWN_FACTOR * 1e3 * (x)), \
#define GRPC_TIMEOUT_MILLIS_TO_DEADLINE(x) \
gpr_time_add( \
gpr_now(GPR_CLOCK_MONOTONIC), \
gpr_time_from_micros((int64_t)(GRPC_TEST_SLOWDOWN_FACTOR * 1e3 * (x)), \
GPR_TIMESPAN))
#ifndef GRPC_TEST_CUSTOM_PICK_PORT

@ -55,7 +55,9 @@ using grpc::testing::EchoRequest;
using grpc::testing::EchoResponse;
using std::chrono::system_clock;
const int kNumThreads = 100; // Number of threads
const int kNumThreads = 100; // Number of threads
const int kNumAsyncSendThreads = 2;
const int kNumAsyncReceiveThreads = 50;
const int kNumRpcs = 1000; // Number of RPCs per thread
namespace grpc {
@ -273,7 +275,7 @@ class AsyncClientEnd2endTest : public ::testing::Test {
for (int i = 0; i < num_rpcs; ++i) {
AsyncClientCall* call = new AsyncClientCall;
EchoRequest request;
request.set_message("Hello");
request.set_message("Hello: " + std::to_string(i));
call->response_reader =
common_.GetStub()->AsyncEcho(&call->context, request, &cq_);
call->response_reader->Finish(&call->response, &call->status,
@ -290,7 +292,9 @@ class AsyncClientEnd2endTest : public ::testing::Test {
bool ok = false;
if (!cq_.Next(&got_tag, &ok)) break;
AsyncClientCall* call = static_cast<AsyncClientCall*>(got_tag);
GPR_ASSERT(ok);
if (!ok) {
gpr_log(GPR_DEBUG, "Error: %d", call->status.error_code());
}
delete call;
bool notify;
@ -315,22 +319,22 @@ class AsyncClientEnd2endTest : public ::testing::Test {
TEST_F(AsyncClientEnd2endTest, ThreadStress) {
common_.ResetStub();
std::vector<std::thread*> send_threads, completion_threads;
for (int i = 0; i < kNumThreads / 2; ++i) {
for (int i = 0; i < kNumAsyncReceiveThreads; ++i) {
completion_threads.push_back(new std::thread(
&AsyncClientEnd2endTest_ThreadStress_Test::AsyncCompleteRpc, this));
}
for (int i = 0; i < kNumThreads / 2; ++i) {
for (int i = 0; i < kNumAsyncSendThreads; ++i) {
send_threads.push_back(
new std::thread(&AsyncClientEnd2endTest_ThreadStress_Test::AsyncSendRpc,
this, kNumRpcs));
}
for (int i = 0; i < kNumThreads / 2; ++i) {
for (int i = 0; i < kNumAsyncSendThreads; ++i) {
send_threads[i]->join();
delete send_threads[i];
}
Wait();
for (int i = 0; i < kNumThreads / 2; ++i) {
for (int i = 0; i < kNumAsyncReceiveThreads; ++i) {
completion_threads[i]->join();
delete completion_threads[i];
}

@ -96,8 +96,7 @@ class ClientRpcContextUnaryImpl : public ClientRpcContext {
std::function<
std::unique_ptr<grpc::ClientAsyncResponseReader<ResponseType>>(
BenchmarkService::Stub*, grpc::ClientContext*, const RequestType&,
CompletionQueue*)>
start_req,
CompletionQueue*)> start_req,
std::function<void(grpc::Status, ResponseType*)> on_done)
: ClientRpcContext(channel_id),
context_(),
@ -143,8 +142,7 @@ class ClientRpcContextUnaryImpl : public ClientRpcContext {
std::function<void(grpc::Status, ResponseType*)> callback_;
std::function<std::unique_ptr<grpc::ClientAsyncResponseReader<ResponseType>>(
BenchmarkService::Stub*, grpc::ClientContext*, const RequestType&,
CompletionQueue*)>
start_req_;
CompletionQueue*)> start_req_;
grpc::Status status_;
double start_;
std::unique_ptr<grpc::ClientAsyncResponseReader<ResponseType>>
@ -164,12 +162,11 @@ class AsyncClient : public ClientImpl<StubType, RequestType> {
using ClientImpl<StubType, RequestType>::cores_;
using ClientImpl<StubType, RequestType>::channels_;
using ClientImpl<StubType, RequestType>::request_;
AsyncClient(
const ClientConfig& config,
std::function<ClientRpcContext*(int, StubType*, const RequestType&)>
setup_ctx,
std::function<std::unique_ptr<StubType>(std::shared_ptr<Channel>)>
create_stub)
AsyncClient(const ClientConfig& config,
std::function<ClientRpcContext*(int, StubType*,
const RequestType&)> setup_ctx,
std::function<std::unique_ptr<StubType>(std::shared_ptr<Channel>)>
create_stub)
: ClientImpl<StubType, RequestType>(config, create_stub),
num_async_threads_(NumThreads(config)),
channel_lock_(new std::mutex[config.client_channels()]),
@ -411,8 +408,7 @@ class ClientRpcContextStreamingImpl : public ClientRpcContext {
std::function<std::unique_ptr<
grpc::ClientAsyncReaderWriter<RequestType, ResponseType>>(
BenchmarkService::Stub*, grpc::ClientContext*, CompletionQueue*,
void*)>
start_req,
void*)> start_req,
std::function<void(grpc::Status, ResponseType*)> on_done)
: ClientRpcContext(channel_id),
context_(),
@ -464,10 +460,10 @@ class ClientRpcContextStreamingImpl : public ClientRpcContext {
ResponseType response_;
bool (ClientRpcContextStreamingImpl::*next_state_)(bool, Histogram*);
std::function<void(grpc::Status, ResponseType*)> callback_;
std::function<std::unique_ptr<
grpc::ClientAsyncReaderWriter<RequestType, ResponseType>>(
BenchmarkService::Stub*, grpc::ClientContext*, CompletionQueue*, void*)>
start_req_;
std::function<
std::unique_ptr<grpc::ClientAsyncReaderWriter<RequestType, ResponseType>>(
BenchmarkService::Stub*, grpc::ClientContext*, CompletionQueue*,
void*)> start_req_;
grpc::Status status_;
double start_;
std::unique_ptr<grpc::ClientAsyncReaderWriter<RequestType, ResponseType>>
@ -511,8 +507,7 @@ class ClientRpcContextGenericStreamingImpl : public ClientRpcContext {
int channel_id, grpc::GenericStub* stub, const ByteBuffer& req,
std::function<std::unique_ptr<grpc::GenericClientAsyncReaderWriter>(
grpc::GenericStub*, grpc::ClientContext*,
const grpc::string& method_name, CompletionQueue*, void*)>
start_req,
const grpc::string& method_name, CompletionQueue*, void*)> start_req,
std::function<void(grpc::Status, ByteBuffer*)> on_done)
: ClientRpcContext(channel_id),
context_(),
@ -569,8 +564,7 @@ class ClientRpcContextGenericStreamingImpl : public ClientRpcContext {
std::function<void(grpc::Status, ByteBuffer*)> callback_;
std::function<std::unique_ptr<grpc::GenericClientAsyncReaderWriter>(
grpc::GenericStub*, grpc::ClientContext*, const grpc::string&,
CompletionQueue*, void*)>
start_req_;
CompletionQueue*, void*)> start_req_;
grpc::Status status_;
double start_;
std::unique_ptr<grpc::GenericClientAsyncReaderWriter> stream_;

@ -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

@ -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
@ -45,7 +45,7 @@ namespace {
class TimeTest : public ::testing::Test {};
TEST_F(TimeTest, AbsolutePointTest) {
long us = 10000000L;
int64_t us = 10000000L;
gpr_timespec ts = gpr_time_from_micros(us, GPR_TIMESPAN);
ts.clock_type = GPR_CLOCK_REALTIME;
system_clock::time_point tp{microseconds(us)};

@ -32,7 +32,7 @@ set -ex
cd $(dirname $0)
unzip "$EXTERNAL_GIT_ROOT/input_artifacts/csharp_nugets.zip" -d TestNugetFeed
unzip -o "$EXTERNAL_GIT_ROOT/input_artifacts/csharp_nugets.zip" -d TestNugetFeed
# TODO(jtattermusch): replace the version number
./update_version.sh 0.13.0

@ -33,4 +33,4 @@ set -e
cd $(dirname $0)
# Replaces version placeholder with value provided as first argument.
sed -i "s/__GRPC_NUGET_VERSION__/$1/g" DistribTest/packages.config DistribTest/DistribTest.csproj
sed -ibak "s/__GRPC_NUGET_VERSION__/$1/g" DistribTest/packages.config DistribTest/DistribTest.csproj

@ -32,7 +32,12 @@ set -ex
cd $(dirname $0)
nvm install $1
NODE_VERSION="$1"
# make sure nvm is available
source ~/.nvm/nvm.sh || true
nvm install $NODE_VERSION
npm install -g node-static

@ -1,3 +1,32 @@
# Copyright 2015-2016, 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.
from grpc.beta import implementations
# This code doesn't do much but makes sure the native extension is loaded

@ -42,17 +42,17 @@ then
exit 1
fi
# TODO(jtattermusch): this shouldn't be required
pip install --upgrade six
PIP=pip2
which $PIP || PIP=pip
PYTHON=python2
which $PYTHON || PYTHON=python
# TODO(jtattermusch): if these don't get preinstalled, pip tries to install them
# with --use-grpc-custom-bdist option, which obviously fails.
pip install --upgrade enum34
pip install --upgrade futures
# TODO(jtattermusch): this shouldn't be required
$PIP install --upgrade six
GRPC_PYTHON_BINARIES_REPOSITORY="${BDIST_DIR}" \
pip install \
"${SDIST_ARCHIVE}" \
--install-option="--use-grpc-custom-bdist"
$PIP install \
"${SDIST_ARCHIVE}"
$PYTHON distribtest.py
python distribtest.py

@ -1,7 +1,7 @@
FROM ubuntu:14.04
RUN apt-get -y update && \
apt-get install -y curl git-core mingw-w64 xz-utils build-essential wget unzip
apt-get install -y curl git-core mingw-w64 xz-utils build-essential gcc-multilib wget unzip
RUN mkdir -p /opt/mingw && \
curl -SL http://downloads.sourceforge.net/mingw-w64/i686-w64-mingw32-gcc-4.7.2-release-linux64_rubenvb.tar.xz | \
@ -103,12 +103,25 @@ RUN bash -c "rvm use 2.3.0 --default && \
export MAKE=\"make -j`nproc`\" CFLAGS='-s -O1 -fno-omit-frame-pointer -fno-fast-math' && \
rake-compiler cross-ruby VERSION=2.3.0 HOST=i686-w64-mingw32 && \
rake-compiler cross-ruby VERSION=2.3.0 HOST=x86_64-w64-mingw32 && \
rake-compiler cross-ruby VERSION=2.3.0 HOST=x86_64-linux-gnu && \
rake-compiler cross-ruby VERSION=2.2.2 HOST=i686-w64-mingw32 && \
rake-compiler cross-ruby VERSION=2.2.2 HOST=x86_64-w64-mingw32 && \
rake-compiler cross-ruby VERSION=2.1.6 HOST=i686-w64-mingw32 && \
rake-compiler cross-ruby VERSION=2.1.6 HOST=x86_64-w64-mingw32 && \
rake-compiler cross-ruby VERSION=2.2.2 HOST=x86_64-linux-gnu && \
rake-compiler cross-ruby VERSION=2.1.5 HOST=i686-w64-mingw32 && \
rake-compiler cross-ruby VERSION=2.1.5 HOST=x86_64-w64-mingw32 && \
rake-compiler cross-ruby VERSION=2.1.5 HOST=x86_64-linux-gnu && \
rake-compiler cross-ruby VERSION=2.0.0-p645 HOST=i686-w64-mingw32 && \
rake-compiler cross-ruby VERSION=2.0.0-p645 HOST=x86_64-w64-mingw32 && \
rake-compiler cross-ruby VERSION=2.0.0-p645 HOST=x86_64-linux-gnu && \
rm -rf ~/.rake-compiler/tmp/builds ~/.rake-compiler/sources && \
find /usr/local/rvm -type d -print0 | sudo xargs -0 chmod g+sw "
RUN bash -c "rvm use 2.3.0 --default && \
export MAKE=\"make -j`nproc`\" CFLAGS='-m32 -s -O1 -fno-omit-frame-pointer -fno-fast-math' LDFLAGS='-m32' && \
rake-compiler cross-ruby VERSION=2.3.0 HOST=i686-linux-gnu && \
rake-compiler cross-ruby VERSION=2.2.2 HOST=i686-linux-gnu && \
rake-compiler cross-ruby VERSION=2.1.5 HOST=i686-linux-gnu && \
rake-compiler cross-ruby VERSION=2.0.0-p645 HOST=i686-linux-gnu && \
rm -rf ~/.rake-compiler/tmp/builds ~/.rake-compiler/sources && \
find /usr/local/rvm -type d -print0 | sudo xargs -0 chmod g+sw "
@ -151,6 +164,6 @@ RUN cp /tmp/build/runas /usr/local/bin/
# Install sudoers configuration
RUN cp /tmp/build/sudoers /etc/sudoers.d/rake-compiler-dock
ENV RUBY_CC_VERSION 2.3.0:2.2.2:2.1.6:2.0.0
ENV RUBY_CC_VERSION 2.3.0:2.2.2:2.1.5:2.0.0
CMD bash

@ -0,0 +1,61 @@
#!/bin/bash
# Copyright 2015-2016, 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.
set -ex
rm -rf ~/.rake-compiler
CROSS_RUBY=`mktemp tmpfile.XXXXXXXX`
curl https://raw.githubusercontent.com/rake-compiler/rake-compiler/v0.9.5/tasks/bin/cross-ruby.rake > $CROSS_RUBY
patch $CROSS_RUBY << EOF
--- cross-ruby.rake 2016-02-05 16:26:53.000000000 -0800
+++ cross-ruby.rake.patched 2016-02-05 16:27:33.000000000 -0800
@@ -133,7 +133,8 @@
"--host=#{MINGW_HOST}",
"--target=#{MINGW_TARGET}",
"--build=#{RUBY_BUILD}",
- '--enable-shared',
+ '--enable-static',
+ '--disable-shared',
'--disable-install-doc',
'--without-tk',
'--without-tcl'
EOF
MAKE="make -j8"
for v in 2.3.0 2.2.2 2.1.5 2.0.0-p645 ; do
rake -f $CROSS_RUBY cross-ruby VERSION=$v HOST=x86_64-darwin11
done
sed 's/x86_64-darwin-11/universal-darwin/' ~/.rake-compiler/config.yml > $CROSS_RUBY
mv $CROSS_RUBY ~/.rake-compiler/config.yml

@ -33,6 +33,5 @@ RUN rpm --import "http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E03
RUN yum-config-manager --add-repo http://download.mono-project.com/repo/centos/
RUN yum install -y mono
RUN yum install -y git
RUN yum install -y unzip
RUN yum install -y nuget

@ -40,4 +40,4 @@ RUN apt-get update && apt-get install -y \
ca-certificates-mono \
nuget
RUN apt-get update && apt-get install -y git unzip
RUN apt-get update && apt-get install -y unzip

@ -40,4 +40,4 @@ RUN apt-get update && apt-get install -y \
ca-certificates-mono \
nuget
RUN apt-get update && apt-get install -y git unzip
RUN apt-get update && apt-get install -y unzip

@ -37,4 +37,4 @@ RUN apt-get update && apt-get install -y \
ca-certificates-mono \
nuget
RUN apt-get update && apt-get install -y git unzip
RUN apt-get update && apt-get install -y unzip

@ -37,4 +37,4 @@ RUN apt-get update && apt-get install -y \
ca-certificates-mono \
nuget
RUN apt-get update && apt-get install -y git unzip
RUN apt-get update && apt-get install -y unzip

@ -37,4 +37,4 @@ RUN apt-get update && apt-get install -y \
ca-certificates-mono \
nuget
RUN apt-get update && apt-get install -y git unzip
RUN apt-get update && apt-get install -y unzip

@ -34,4 +34,4 @@ RUN apt-get update && apt-get install -y \
ca-certificates-mono \
nuget
RUN apt-get update && apt-get install -y git unzip
RUN apt-get update && apt-get install -y unzip

@ -29,4 +29,4 @@
FROM mono:4.2.2.30
RUN apt-get update && apt-get install -y git unzip
RUN apt-get update && apt-get install -y unzip

@ -29,7 +29,6 @@
FROM centos:7
RUN yum install -y git
RUN yum install -y curl
# Install nvm

@ -29,7 +29,7 @@
FROM debian:jessie
RUN apt-get update && apt-get install -y curl git
RUN apt-get update && apt-get install -y curl
# Install nvm
RUN touch .profile

@ -29,8 +29,8 @@
FROM 32bit/debian:jessie
RUN apt-get update && apt-get install -y curl git
RUN apt-get update && apt-get install -y curl
# Install nvm
RUN touch .profile
RUN curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.30.2/install.sh | bash
RUN curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.30.2/install.sh | bash

@ -29,7 +29,7 @@
FROM ubuntu:12.04
RUN apt-get update && apt-get install -y curl git
RUN apt-get update && apt-get install -y curl
# Install nvm
RUN touch .profile

@ -29,7 +29,7 @@
FROM ubuntu:14.04
RUN apt-get update && apt-get install -y curl git
RUN apt-get update && apt-get install -y curl
# Install nvm
RUN touch .profile

@ -29,7 +29,7 @@
FROM ubuntu:15.04
RUN apt-get update && apt-get install -y curl git
RUN apt-get update && apt-get install -y curl
# Install nvm
RUN touch .profile

@ -29,7 +29,7 @@
FROM ubuntu:15.10
RUN apt-get update && apt-get install -y curl git
RUN apt-get update && apt-get install -y curl
# Install nvm
RUN touch .profile

@ -29,7 +29,7 @@
FROM ubuntu:16.04
RUN apt-get update && apt-get install -y curl git
RUN apt-get update && apt-get install -y curl
# Install nvm
RUN touch .profile

@ -30,7 +30,7 @@
FROM base/archlinux
RUN pacman --noconfirm -Syy
RUN pacman --noconfirm -S git
RUN pacman --noconfirm -S python
RUN pacman --noconfirm -S python-pip
RUN pacman --noconfirm -S openssl
RUN pacman --noconfirm -S python2
RUN pacman --noconfirm -S python2-pip

@ -29,9 +29,10 @@
FROM centos:6
RUN yum install -y git
RUN yum install -y python
RUN rpm -ivh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
RUN yum install -y python-pip
RUN pip install --upgrade pip

@ -29,7 +29,6 @@
FROM centos:7
RUN yum install -y git
RUN yum install -y python
RUN yum install -y epel-release
RUN yum install -y python-pip

@ -29,9 +29,4 @@
FROM fedora:20
RUN yum clean all
RUN yum update -y
RUN yum install -y git
RUN yum install -y python
RUN yum install -y python-pip
RUN yum clean all && yum update -y && yum install -y python python-pip

@ -29,9 +29,4 @@
FROM fedora:21
RUN yum clean all
RUN yum update -y
RUN yum install -y git
RUN yum install -y python
RUN yum install -y python-pip
RUN yum clean all && yum update -y && yum install -y python python-pip

@ -29,9 +29,4 @@
FROM fedora:22
RUN yum clean all
RUN yum update -y
RUN yum install -y git
RUN yum install -y python
RUN yum install -y python-pip
RUN yum clean all && yum update -y && yum install -y python python-pip

@ -29,9 +29,4 @@
FROM fedora:23
RUN yum clean all
RUN yum update -y
RUN yum install -y git
RUN yum install -y python
RUN yum install -y python-pip
RUN yum clean all && yum update -y && yum install -y python python-pip

@ -29,6 +29,4 @@
FROM debian:jessie
RUN apt-get update
RUN apt-get install -y git python python-pip
RUN apt-get update && apt-get install -y python python-pip

@ -29,6 +29,9 @@
FROM 32bit/debian:jessie
RUN apt-get update
RUN apt-get install -y git python python-pip
RUN apt-get update && apt-get install -y python python-pip
# docker is running on a 64-bit machine, so we need to
# override "uname -m" to report i686 instead of x86_64, otherwise
# python will choose a wrong binary package to install.
ENTRYPOINT ["linux32"]

@ -29,7 +29,5 @@
FROM opensuse:42.1
RUN zypper --non-interactive install git
RUN zypper --non-interactive install python
RUN zypper --non-interactive install python-pip

@ -29,8 +29,4 @@
FROM ubuntu:12.04
RUN apt-get update -y
RUN apt-get install -y git
RUN apt-get install -y python
RUN apt-get install -y python-pip
RUN apt-get update -y && apt-get install -y python python-pip

@ -29,8 +29,4 @@
FROM ubuntu:14.04
RUN apt-get update -y
RUN apt-get install -y git
RUN apt-get install -y python
RUN apt-get install -y python-pip
RUN apt-get update -y && apt-get install -y python python-pip

@ -29,8 +29,4 @@
FROM ubuntu:15.04
RUN apt-get update -y
RUN apt-get install -y git
RUN apt-get install -y python
RUN apt-get install -y python-pip
RUN apt-get update -y && apt-get install -y python python-pip

@ -29,8 +29,4 @@
FROM ubuntu:15.10
RUN apt-get update -y
RUN apt-get install -y git
RUN apt-get install -y python
RUN apt-get install -y python-pip
RUN apt-get update -y && apt-get install -y python python-pip

@ -29,8 +29,4 @@
FROM ubuntu:16.04
RUN apt-get update -y
RUN apt-get install -y git
RUN apt-get install -y python
RUN apt-get install -y python-pip
RUN apt-get update -y && apt-get install -y python python-pip

@ -29,6 +29,4 @@
FROM debian:wheezy
RUN apt-get update
RUN apt-get install -y git python python-pip
RUN apt-get update -y && apt-get install -y python python-pip

@ -29,6 +29,4 @@
FROM centos:6
RUN yum install -y git
RUN yum install -y ruby

@ -29,6 +29,4 @@
FROM centos:7
RUN yum install -y git
RUN yum install -y ruby

@ -29,8 +29,4 @@
FROM fedora:20
RUN yum clean all
RUN yum update -y
RUN yum install -y git
RUN yum install -y ruby
RUN yum clean all && yum update -y && yum install -y ruby

@ -29,8 +29,4 @@
FROM fedora:21
RUN yum clean all
RUN yum update -y
RUN yum install -y git
RUN yum install -y ruby
RUN yum clean all && yum update -y && yum install -y ruby

@ -29,8 +29,4 @@
FROM fedora:22
RUN yum clean all
RUN yum update -y
RUN yum install -y git
RUN yum install -y ruby
RUN yum clean all && yum update -y && yum install -y ruby

@ -29,8 +29,4 @@
FROM fedora:23
RUN yum clean all
RUN yum update -y
RUN yum install -y git
RUN yum install -y ruby
RUN yum clean all && yum update -y && yum install -y ruby

@ -29,7 +29,4 @@
FROM debian:jessie
RUN apt-get update
RUN apt-get install -y git
RUN apt-get install -y ruby-full
RUN apt-get update && apt-get install -y ruby-full

@ -29,7 +29,4 @@
FROM 32bit/debian:jessie
RUN apt-get update
RUN apt-get install -y git
RUN apt-get install -y ruby-full
RUN apt-get update && apt-get install -y ruby-full

@ -29,6 +29,4 @@
FROM opensuse:42.1
RUN zypper --non-interactive install git
RUN zypper --non-interactive install ruby

@ -29,7 +29,4 @@
FROM ubuntu:12.04
RUN apt-get update -y
RUN apt-get install -y git
RUN apt-get install -y ruby-full
RUN apt-get update -y && apt-get install -y ruby-full

@ -29,7 +29,4 @@
FROM ubuntu:14.04
RUN apt-get update -y
RUN apt-get install -y git
RUN apt-get install -y ruby-full
RUN apt-get update -y && apt-get install -y ruby-full

@ -29,7 +29,4 @@
FROM ubuntu:15.04
RUN apt-get update -y
RUN apt-get install -y git
RUN apt-get install -y ruby-full
RUN apt-get update -y && apt-get install -y ruby-full

@ -29,7 +29,4 @@
FROM ubuntu:15.10
RUN apt-get update -y
RUN apt-get install -y git
RUN apt-get install -y ruby-full
RUN apt-get update -y && apt-get install -y ruby-full

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save