aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Craig Tiller <craig.tiller@gmail.com>2015-05-27 16:28:34 -0700
committerGravatar Craig Tiller <craig.tiller@gmail.com>2015-05-27 16:28:34 -0700
commit5d8310e104d32ff13cac651b817a9748d7714783 (patch)
tree57c761ddb1d85665ba9867f5daaf428a365f3eed /src
parentf3b07aaad2479e45413b2257206e8200cbf3ec73 (diff)
parent8c627c8cd01449571679de4e1521511d302b2ff1 (diff)
Merge github.com:grpc/grpc into we-dont-need-no-backup
Diffstat (limited to 'src')
-rw-r--r--src/core/surface/server.c9
-rw-r--r--src/core/surface/server.h2
-rw-r--r--src/core/transport/chttp2/alpn.c3
-rw-r--r--src/objective-c/ProtoRPC/ProtoRPC.m4
-rw-r--r--src/objective-c/examples/Sample/Sample/ViewController.m2
-rw-r--r--src/objective-c/examples/Sample/SampleTests/RemoteTests.m2
-rw-r--r--src/objective-c/examples/Sample/SampleTests/SampleTests.m2
7 files changed, 18 insertions, 6 deletions
diff --git a/src/core/surface/server.c b/src/core/surface/server.c
index e99e3e2b04..a60d5f7717 100644
--- a/src/core/surface/server.c
+++ b/src/core/surface/server.c
@@ -1131,3 +1131,12 @@ static void publish_registered_or_batch(grpc_call *call, int success,
const grpc_channel_args *grpc_server_get_channel_args(grpc_server *server) {
return server->channel_args;
}
+
+int grpc_server_has_open_connections(grpc_server *server) {
+ int r;
+ gpr_mu_lock(&server->mu);
+ r = server->root_channel_data.next != &server->root_channel_data;
+ gpr_mu_unlock(&server->mu);
+ return r;
+}
+
diff --git a/src/core/surface/server.h b/src/core/surface/server.h
index c6331033e0..58f17272a4 100644
--- a/src/core/surface/server.h
+++ b/src/core/surface/server.h
@@ -62,4 +62,6 @@ grpc_transport_setup_result grpc_server_setup_transport(
const grpc_channel_args *grpc_server_get_channel_args(grpc_server *server);
+int grpc_server_has_open_connections(grpc_server *server);
+
#endif /* GRPC_INTERNAL_CORE_SURFACE_SERVER_H */
diff --git a/src/core/transport/chttp2/alpn.c b/src/core/transport/chttp2/alpn.c
index 11901a58a0..3ccd5796ba 100644
--- a/src/core/transport/chttp2/alpn.c
+++ b/src/core/transport/chttp2/alpn.c
@@ -36,7 +36,8 @@
#include <grpc/support/useful.h>
/* in order of preference */
-static const char *const supported_versions[] = {"h2-16", "h2-15", "h2-14"};
+static const char *const supported_versions[] = {"h2", "h2-17", "h2-16",
+ "h2-15", "h2-14"};
int grpc_chttp2_is_alpn_version_supported(const char *version, size_t size) {
size_t i;
diff --git a/src/objective-c/ProtoRPC/ProtoRPC.m b/src/objective-c/ProtoRPC/ProtoRPC.m
index 96608f2898..b8f8008422 100644
--- a/src/objective-c/ProtoRPC/ProtoRPC.m
+++ b/src/objective-c/ProtoRPC/ProtoRPC.m
@@ -59,7 +59,7 @@
responseClass:(Class)responseClass
responsesWriteable:(id<GRXWriteable>)responsesWriteable {
// Because we can't tell the type system to constrain the class, we need to check at runtime:
- if (![responseClass respondsToSelector:@selector(parseFromData:)]) {
+ if (![responseClass respondsToSelector:@selector(parseFromData:error:)]) {
[NSException raise:NSInvalidArgumentException
format:@"A protobuf class to parse the responses must be provided."];
}
@@ -71,7 +71,7 @@
if ((self = [super initWithHost:host method:method requestsWriter:bytesWriter])) {
// A writeable that parses the proto messages received.
_responseWriteable = [[GRXWriteable alloc] initWithValueHandler:^(NSData *value) {
- [responsesWriteable writeValue:[responseClass parseFromData:value]];
+ [responsesWriteable writeValue:[responseClass parseFromData:value error:NULL]];
} completionHandler:^(NSError *errorOrNil) {
[responsesWriteable writesFinishedWithError:errorOrNil];
}];
diff --git a/src/objective-c/examples/Sample/Sample/ViewController.m b/src/objective-c/examples/Sample/Sample/ViewController.m
index 1c866babec..9b331fe43f 100644
--- a/src/objective-c/examples/Sample/Sample/ViewController.m
+++ b/src/objective-c/examples/Sample/Sample/ViewController.m
@@ -80,7 +80,7 @@
requestsWriter:requestsWriter];
id<GRXWriteable> responsesWriteable = [[GRXWriteable alloc] initWithValueHandler:^(NSData *value) {
- RMTSimpleResponse *response = [RMTSimpleResponse parseFromData:value];
+ RMTSimpleResponse *response = [RMTSimpleResponse parseFromData:value error:NULL];
NSLog(@"Received response:\n%@", response);
} completionHandler:^(NSError *errorOrNil) {
if (errorOrNil) {
diff --git a/src/objective-c/examples/Sample/SampleTests/RemoteTests.m b/src/objective-c/examples/Sample/SampleTests/RemoteTests.m
index 553c813b0b..ceb72cfaec 100644
--- a/src/objective-c/examples/Sample/SampleTests/RemoteTests.m
+++ b/src/objective-c/examples/Sample/SampleTests/RemoteTests.m
@@ -125,7 +125,7 @@
XCTAssertNotNil(value, @"nil value received as response.");
[response fulfill];
XCTAssertGreaterThan(value.length, 0, @"Empty response received.");
- RMTSimpleResponse *response = [RMTSimpleResponse parseFromData:value];
+ RMTSimpleResponse *response = [RMTSimpleResponse parseFromData:value error:NULL];
// We expect empty strings, not nil:
XCTAssertNotNil(response.username, @"Response's username is nil.");
XCTAssertNotNil(response.oauthScope, @"Response's OAuth scope is nil.");
diff --git a/src/objective-c/examples/Sample/SampleTests/SampleTests.m b/src/objective-c/examples/Sample/SampleTests/SampleTests.m
index b1a0f78a01..83cfd8c1b5 100644
--- a/src/objective-c/examples/Sample/SampleTests/SampleTests.m
+++ b/src/objective-c/examples/Sample/SampleTests/SampleTests.m
@@ -123,7 +123,7 @@
id<GRXWriteable> responsesWriteable = [[GRXWriteable alloc] initWithValueHandler:^(NSData *value) {
XCTAssertNotNil(value, @"nil value received as response.");
- RGDFeature *feature = [RGDFeature parseFromData:value];
+ RGDFeature *feature = [RGDFeature parseFromData:value error:NULL];
XCTAssertEqualObjects(point, feature.location);
XCTAssertNotNil(feature.name, @"Response's name is nil.");
[response fulfill];