diff --git a/examples/node/greeter_client.js b/examples/node/greeter_client.js index e0b89bd376a..9b4b0a77829 100644 --- a/examples/node/greeter_client.js +++ b/examples/node/greeter_client.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 @@ -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() { diff --git a/examples/node/greeter_server.js b/examples/node/greeter_server.js index 3600c8bfbf4..2712b3dd3ad 100644 --- a/examples/node/greeter_server.js +++ b/examples/node/greeter_server.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 @@ -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; /** diff --git a/examples/node/package.json b/examples/node/package.json new file mode 100644 index 00000000000..65c5789ed7b --- /dev/null +++ b/examples/node/package.json @@ -0,0 +1,7 @@ +{ + "name": "grpc-examples", + "version": "0.1.0", + "dependencies": { + "grpc": "0.12.0" + } +} diff --git a/examples/node/route_guide/route_guide_client.js b/examples/node/route_guide/route_guide_client.js index edeca6ff553..e38a21f4228 100644 --- a/examples/node/route_guide/route_guide_client.js +++ b/examples/node/route_guide/route_guide_client.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 @@ -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()); diff --git a/examples/node/route_guide/route_guide_server.js b/examples/node/route_guide/route_guide_server.js index 2090a6a1d2f..06cf2925e1c 100644 --- a/examples/node/route_guide/route_guide_server.js +++ b/examples/node/route_guide/route_guide_server.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 @@ -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; diff --git a/src/core/iomgr/tcp_server.h b/src/core/iomgr/tcp_server.h index 8f3184ff1e0..a39dd3bafce 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 cd0afddf9df..2c97ee18be1 100644 --- a/src/core/support/stack_lockfree.c +++ b/src/core/support/stack_lockfree.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 @@ -99,6 +99,11 @@ 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 */ +#ifdef GPR_ARCH_64 + stack->head.contents.pad = 0; +#endif + stack->head.contents.aba_ctr = 0; return stack; } @@ -115,6 +120,11 @@ int gpr_stack_lockfree_push(gpr_stack_lockfree *stack, int entry) { /* First fill in the entry's index and aba ctr for new head */ newhead.contents.index = (uint16_t)entry; +#ifdef GPR_ARCH_64 + /* Fill in the pad to avoid confusing memcheck tools */ + newhead.contents.pad = 0; +#endif + /* Also post-increment the aba_ctr */ curent.atm = gpr_atm_no_barrier_load(&stack->entries[entry].atm); newhead.contents.aba_ctr = ++curent.contents.aba_ctr; diff --git a/src/csharp/Grpc.Core/Internal/NativeExtension.cs b/src/csharp/Grpc.Core/Internal/NativeExtension.cs index e14d33ea506..4c742ab6c3d 100644 --- a/src/csharp/Grpc.Core/Internal/NativeExtension.cs +++ b/src/csharp/Grpc.Core/Internal/NativeExtension.cs @@ -106,7 +106,7 @@ namespace Grpc.Core.Internal private static string GetExecutingAssemblyDirectory() { - return Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + return Path.GetDirectoryName(typeof(NativeExtension).GetTypeInfo().Assembly.Location); } private static string GetPlatformString() diff --git a/test/distrib/node/run_distrib_test.sh b/test/distrib/node/run_distrib_test.sh index dbbcad25e42..90637cc01d0 100755 --- a/test/distrib/node/run_distrib_test.sh +++ b/test/distrib/node/run_distrib_test.sh @@ -36,17 +36,17 @@ nvm install $1 npm install -g node-static -STATIC_SERVER=localhost +STATIC_SERVER=127.0.0.1 STATIC_PORT=8080 # Serves the input_artifacts directory statically at localhost:8080 -static "$EXTERNAL_GIT_ROOT/input_artifacts" -a STATIC_SERVER -p STATIC_PORT & +static "$EXTERNAL_GIT_ROOT/input_artifacts" -a $STATIC_SERVER -p $STATIC_PORT & STATIC_PID=$! STATIC_URL="http://$STATIC_SERVER:$STATIC_PORT/" npm install --unsafe-perm $STATIC_URL/grpc.tgz --grpc_node_binary_host_mirror=$STATIC_URL -kill $STATIC_PID +kill -9 $STATIC_PID ./distrib_test.js diff --git a/tools/run_tests/distribtest_targets.py b/tools/run_tests/distribtest_targets.py index 7fd0800fa0f..e9a80d2cf40 100644 --- a/tools/run_tests/distribtest_targets.py +++ b/tools/run_tests/distribtest_targets.py @@ -104,7 +104,8 @@ class NodeDistribTest(object): 'tools/dockerfile/distribtest/node_%s_%s' % ( self.docker_suffix, self.arch), - 'test/distrib/node/run_distrib_test.sh %s' % ( + # bash -l needed to make nvm available + 'bash -l test/distrib/node/run_distrib_test.sh %s' % ( self.node_version)) def __str__(self): return self.name