diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/core/transport/transport.h | 15 | ||||
-rw-r--r-- | src/node/ext/node_grpc.cc | 4 | ||||
-rw-r--r-- | src/node/performance/benchmark_server.js | 2 | ||||
-rw-r--r-- | src/node/performance/worker_service_impl.js | 4 | ||||
-rw-r--r-- | src/objective-c/BoringSSL.podspec | 4 | ||||
-rw-r--r-- | src/proto/grpc/testing/control.proto | 2 | ||||
-rw-r--r-- | src/python/README.md | 100 | ||||
-rw-r--r-- | src/ruby/ext/grpc/extconf.rb | 64 | ||||
-rw-r--r-- | src/ruby/ext/grpc/rb_grpc.c | 2 | ||||
-rw-r--r-- | src/ruby/lib/grpc/grpc.rb | 34 |
10 files changed, 110 insertions, 121 deletions
diff --git a/src/core/transport/transport.h b/src/core/transport/transport.h index f94f0ae76e..f5cac77adc 100644 --- a/src/core/transport/transport.h +++ b/src/core/transport/transport.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 @@ -81,16 +81,29 @@ void grpc_stream_unref(grpc_exec_ctx *exec_ctx, grpc_stream_refcount *refcount); /* Transport stream op: a set of operations to perform on a transport against a single stream */ typedef struct grpc_transport_stream_op { + /** Send initial metadata to the peer, from the provided metadata batch. */ grpc_metadata_batch *send_initial_metadata; + + /** Send trailing metadata to the peer, from the provided metadata batch. */ grpc_metadata_batch *send_trailing_metadata; + /** Send message data to the peer, from the provided byte stream. */ grpc_byte_stream *send_message; + /** Receive initial metadata from the stream, into provided metadata batch. */ grpc_metadata_batch *recv_initial_metadata; + + /** Receive message data from the stream, into provided byte stream. */ grpc_byte_stream **recv_message; + /** Should be enqueued when one message is ready to be processed. */ grpc_closure *recv_message_ready; + + /** Receive trailing metadata from the stream, into provided metadata batch. + */ grpc_metadata_batch *recv_trailing_metadata; + /** Should be enqueued when all requested operations (excluding recv_message + which has its own closure) in a given batch have been completed. */ grpc_closure *on_complete; /** If != GRPC_STATUS_OK, cancel this stream */ diff --git a/src/node/ext/node_grpc.cc b/src/node/ext/node_grpc.cc index a2b8e0d22b..654c5aed09 100644 --- a/src/node/ext/node_grpc.cc +++ b/src/node/ext/node_grpc.cc @@ -112,8 +112,8 @@ void InitCallErrorConstants(Local<Object> exports) { Nan::Set(exports, Nan::New("callError").ToLocalChecked(), call_error); Local<Value> OK(Nan::New<Uint32, uint32_t>(GRPC_CALL_OK)); Nan::Set(call_error, Nan::New("OK").ToLocalChecked(), OK); - Local<Value> ERROR(Nan::New<Uint32, uint32_t>(GRPC_CALL_ERROR)); - Nan::Set(call_error, Nan::New("ERROR").ToLocalChecked(), ERROR); + Local<Value> CALL_ERROR(Nan::New<Uint32, uint32_t>(GRPC_CALL_ERROR)); + Nan::Set(call_error, Nan::New("ERROR").ToLocalChecked(), CALL_ERROR); Local<Value> NOT_ON_SERVER( Nan::New<Uint32, uint32_t>(GRPC_CALL_ERROR_NOT_ON_SERVER)); Nan::Set(call_error, Nan::New("NOT_ON_SERVER").ToLocalChecked(), diff --git a/src/node/performance/benchmark_server.js b/src/node/performance/benchmark_server.js index ba61e52ba1..e48acd48f5 100644 --- a/src/node/performance/benchmark_server.js +++ b/src/node/performance/benchmark_server.js @@ -76,7 +76,7 @@ function unaryCall(call, callback) { */ function streamingCall(call) { call.on('data', function(value) { - var payload = {body: zeroBuffer(value.repsonse_size)}; + var payload = {body: zeroBuffer(value.response_size)}; call.write({payload: payload}); }); call.on('end', function() { diff --git a/src/node/performance/worker_service_impl.js b/src/node/performance/worker_service_impl.js index 8841ae13c3..99ae32127e 100644 --- a/src/node/performance/worker_service_impl.js +++ b/src/node/performance/worker_service_impl.js @@ -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 @@ -99,7 +99,7 @@ exports.runServer = function runServer(call) { var stats; switch (request.argtype) { case 'setup': - server = new BenchmarkServer(request.setup.host, request.setup.port, + server = new BenchmarkServer('[::]', request.setup.port, request.setup.security_params); server.start(); stats = server.mark(); diff --git a/src/objective-c/BoringSSL.podspec b/src/objective-c/BoringSSL.podspec index f5b738203d..4a6df910a7 100644 --- a/src/objective-c/BoringSSL.podspec +++ b/src/objective-c/BoringSSL.podspec @@ -31,7 +31,7 @@ Pod::Spec.new do |s| s.name = 'BoringSSL' - s.version = '1.0' + s.version = '2.0' s.summary = 'BoringSSL is a fork of OpenSSL that is designed to meet Google’s needs.' # Adapted from the homepage: s.description = <<-DESC @@ -67,7 +67,7 @@ Pod::Spec.new do |s| s.authors = 'Adam Langley', 'David Benjamin', 'Matt Braithwaite' s.source = { :git => 'https://boringssl.googlesource.com/boringssl', - :tag => 'version_for_cocoapods_1.0' } + :tag => 'version_for_cocoapods_2.0' } s.source_files = 'ssl/*.{h,c}', 'ssl/**/*.{h,c}', diff --git a/src/proto/grpc/testing/control.proto b/src/proto/grpc/testing/control.proto index 7ba6f9856f..2f352e652f 100644 --- a/src/proto/grpc/testing/control.proto +++ b/src/proto/grpc/testing/control.proto @@ -127,8 +127,6 @@ message ClientArgs { message ServerConfig { ServerType server_type = 1; SecurityParams security_params = 2; - // Host on which to listen. - string host = 3; // Port on which to listen. Zero means pick unused port. int32 port = 4; // Only for async server. Number of threads used to serve the requests. diff --git a/src/python/README.md b/src/python/README.md deleted file mode 100644 index 8b167659ff..0000000000 --- a/src/python/README.md +++ /dev/null @@ -1,100 +0,0 @@ -gRPC Python -========= -The Python facility of gRPC. - -Status -------- -Beta : Core behavior well-used and proven; bugs lurk off the beaten path. - -PREREQUISITES -------------- -- python-virtualenv, python-pip, python3-pip, python-dev, python3-dev -- [homebrew][] on Mac OS X. These simplify the installation of the gRPC C core. - -INSTALLATION -------------- - -**Linux (Debian):** - -Add [Debian jessie-backports][] to your `sources.list` file. Example: - -```sh -echo "deb http://http.debian.net/debian jessie-backports main" | \ -sudo tee -a /etc/apt/sources.list -``` - -Install the gRPC Debian package - -```sh -sudo apt-get update -sudo apt-get install libgrpc-dev -``` - -Install the gRPC Python module - -```sh -sudo pip install grpcio -``` - -**Mac OS X** - -Install [homebrew][]. Run the following command to install gRPC Python. -```sh -$ curl -fsSL https://goo.gl/getgrpc | bash -s python -``` -This will download and run the [gRPC install script][], then install the latest version of the gRPC Python package. It also installs the Protocol Buffers compiler (_protoc_) and the gRPC _protoc_ plugin for python. - -EXAMPLES --------- -Please read our online documentation for a [Quick Start][] and a [detailed example][] - -BUILDING FROM SOURCE ---------------------- -- Clone this repository - -- Install tox -``` -$ sudo pip install tox -``` - -- Initialize the git submodules -``` -$ git submodule update --init -``` - -- Make the libraries -``` -$ make -``` - -- Use build_python.sh to build the Python code and install it into a virtual environment -``` -$ CONFIG=opt tools/run_tests/build_python.sh -``` - -TESTING -------- - -- Use run_python.sh to run gRPC as it was installed into the virtual environment -``` -$ CONFIG=opt PYVER=2.7 tools/run_tests/run_python.sh -``` - -PACKAGING ---------- - -- Install packaging dependencies -``` -$ pip install setuptools twine -``` - -- Push to PyPI -``` -$ ../../tools/distrib/python/submit.py -``` - -[homebrew]:http://brew.sh -[gRPC install script]:https://raw.githubusercontent.com/grpc/homebrew-grpc/master/scripts/install -[Quick Start]:http://www.grpc.io/docs/tutorials/basic/python.html -[detailed example]:http://www.grpc.io/docs/installation/python.html -[Debian jessie-backports]:http://backports.debian.org/Instructions/ diff --git a/src/ruby/ext/grpc/extconf.rb b/src/ruby/ext/grpc/extconf.rb index 018353ce5d..52c512e015 100644 --- a/src/ruby/ext/grpc/extconf.rb +++ b/src/ruby/ext/grpc/extconf.rb @@ -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 @@ -54,9 +54,6 @@ LIB_DIRS = [ LIBDIR ] -fail 'libdl not found' unless have_library('dl', 'dlopen') -fail 'zlib not found' unless have_library('z', 'inflate') - grpc_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) grpc_config = ENV['GRPC_CONFIG'] || 'opt' @@ -64,12 +61,37 @@ grpc_config = ENV['GRPC_CONFIG'] || 'opt' if ENV.key?('GRPC_LIB_DIR') grpc_lib_dir = File.join(grpc_root, ENV['GRPC_LIB_DIR']) else - grpc_lib_dir = File.join(File.join(grpc_root, 'libs'), grpc_config) + grpc_lib_dir = File.join(grpc_root, 'libs', grpc_config) end unless File.exist?(File.join(grpc_lib_dir, 'libgrpc.a')) - print "Building internal gRPC\n" - system("make -C #{grpc_root} static_c CONFIG=#{grpc_config}") + for var in %w( CC AR ) do + ENV[var] = RbConfig::CONFIG[var] + end + + ENV['LD'] = ENV['CC'] + + if RUBY_PLATFORM =~ /mingw|mswin/ + ENV['SYSTEM'] = 'MINGW32' + end + + ENV['EMBED_OPENSSL'] = 'true' + ENV['EMBED_ZLIB'] = 'true' + + grpc_cppflags = '' + grpc_cppflags << ' -D_WIN32_WINNT=0x600 ' + grpc_cppflags << ' -DUNICODE ' + grpc_cppflags << ' -D_UNICODE ' + + ENV['CPPFLAGS'] = grpc_cppflags + + output_dir = File.expand_path(RbConfig::CONFIG['topdir']) + grpc_lib_dir = File.join(output_dir, 'libs', grpc_config) + ENV['BUILDDIR'] = output_dir + + puts 'Building internal gRPC into ' + grpc_lib_dir + system("make -j -C #{grpc_root} #{grpc_lib_dir}/libgpr.a #{grpc_lib_dir}/libgrpc.a CONFIG=#{grpc_config}") + exit 1 unless $? == 0 end $CFLAGS << ' -I' + File.join(grpc_root, 'include') @@ -85,8 +107,30 @@ $CFLAGS << ' -Wall ' $CFLAGS << ' -Wextra ' $CFLAGS << ' -pedantic ' $CFLAGS << ' -Werror ' +$CFLAGS << ' -Wno-format ' -$LDFLAGS << ' -lssl ' -$LDFLAGS << ' -lcrypto ' +case RUBY_PLATFORM +when /mingw|mswin/ + $LDFLAGS << ' -static ' +end -create_makefile('grpc/grpc') +output = File.join('grpc', 'grpc_c') +puts 'Generating Makefile for ' + output +create_makefile(output) + +strip_tool = RbConfig::CONFIG['STRIP'] + +if grpc_config == 'opt' + File.open('Makefile.new', 'w') do |o| + o.puts 'hijack: all strip' + o.puts + File.foreach('Makefile') do |i| + o.puts i + end + o.puts + o.puts 'strip:' + o.puts "\t$(ECHO) Stripping $(DLLIB)" + o.puts "\t$(Q) #{strip_tool} $(DLLIB)" + end + File.rename('Makefile.new', 'Makefile') +end diff --git a/src/ruby/ext/grpc/rb_grpc.c b/src/ruby/ext/grpc/rb_grpc.c index 265ab58ecb..9514d54c17 100644 --- a/src/ruby/ext/grpc/rb_grpc.c +++ b/src/ruby/ext/grpc/rb_grpc.c @@ -297,7 +297,7 @@ VALUE sym_code = Qundef; VALUE sym_details = Qundef; VALUE sym_metadata = Qundef; -void Init_grpc() { +void Init_grpc_c() { grpc_init(); /* TODO: find alternative to ruby_vm_at_exit that is ok in Ruby 2.0 */ diff --git a/src/ruby/lib/grpc/grpc.rb b/src/ruby/lib/grpc/grpc.rb new file mode 100644 index 0000000000..d8a4947494 --- /dev/null +++ b/src/ruby/lib/grpc/grpc.rb @@ -0,0 +1,34 @@ +# 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. + +begin + require "grpc/#{RUBY_VERSION.sub(/\.\d$/, '')}/grpc_c" +rescue LoadError + require 'grpc/grpc_c' +end |