aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Yang Gao <yangg@google.com>2015-02-17 11:48:52 -0800
committerGravatar Yang Gao <yangg@google.com>2015-02-17 11:48:52 -0800
commit0b7c4d29d43390247a45295453184cd140a6fc6a (patch)
treedebb6635ac5e496419fcc3416015633d4e6d5b53
parent27658f41baa23b9f2fcaa963da08bdceb91ea924 (diff)
parent5b589fa45df38306347d31f4f79366e0bca3422d (diff)
Merge branch 'c++api' of github.com:ctiller/grpc into c++api
-rw-r--r--src/core/channel/connected_channel.c6
-rw-r--r--src/core/iomgr/tcp_server_posix.c13
-rw-r--r--src/ruby/spec/client_server_spec.rb10
-rw-r--r--test/core/fling/client.c4
-rw-r--r--test/core/fling/server.c8
-rw-r--r--test/core/transport/metadata_test.c2
6 files changed, 24 insertions, 19 deletions
diff --git a/src/core/channel/connected_channel.c b/src/core/channel/connected_channel.c
index 61a6caf032..2d61d389e4 100644
--- a/src/core/channel/connected_channel.c
+++ b/src/core/channel/connected_channel.c
@@ -467,17 +467,11 @@ static void transport_goaway(void *user_data, grpc_transport *transport,
/* transport got goaway ==> call up and handle it */
grpc_channel_element *elem = user_data;
channel_data *chand = elem->channel_data;
- char *msg;
grpc_channel_op op;
GPR_ASSERT(elem->filter == &grpc_connected_channel_filter);
GPR_ASSERT(chand->transport == transport);
- msg = gpr_hexdump((const char *)GPR_SLICE_START_PTR(debug),
- GPR_SLICE_LENGTH(debug), GPR_HEXDUMP_PLAINTEXT);
- gpr_log(GPR_DEBUG, "got goaway: status=%d, message=%s", status, msg);
- gpr_free(msg);
-
op.type = GRPC_TRANSPORT_GOAWAY;
op.dir = GRPC_CALL_UP;
op.data.goaway.status = status;
diff --git a/src/core/iomgr/tcp_server_posix.c b/src/core/iomgr/tcp_server_posix.c
index d8b180f7f0..a4c766eba4 100644
--- a/src/core/iomgr/tcp_server_posix.c
+++ b/src/core/iomgr/tcp_server_posix.c
@@ -75,7 +75,11 @@ typedef struct {
int fd;
grpc_fd *emfd;
grpc_tcp_server *server;
- gpr_uint8 addr[GRPC_MAX_SOCKADDR_SIZE];
+ union {
+ gpr_uint8 untyped[GRPC_MAX_SOCKADDR_SIZE];
+ struct sockaddr sockaddr;
+ struct sockaddr_un un;
+ } addr;
int addr_len;
} server_port;
@@ -125,9 +129,8 @@ void grpc_tcp_server_destroy(grpc_tcp_server *s) {
/* delete ALL the things */
for (i = 0; i < s->nports; i++) {
server_port *sp = &s->ports[i];
- if (((struct sockaddr *)sp->addr)->sa_family == AF_UNIX) {
- struct sockaddr_un *un = (struct sockaddr_un *)sp->addr;
- unlink(un->sun_path);
+ if (sp->addr.sockaddr.sa_family == AF_UNIX) {
+ unlink(sp->addr.un.sun_path);
}
grpc_fd_orphan(sp->emfd, NULL, NULL);
}
@@ -273,7 +276,7 @@ static int add_socket_to_server(grpc_tcp_server *s, int fd,
sp->server = s;
sp->fd = fd;
sp->emfd = grpc_fd_create(fd);
- memcpy(sp->addr, addr, addr_len);
+ memcpy(sp->addr.untyped, addr, addr_len);
sp->addr_len = addr_len;
GPR_ASSERT(sp->emfd);
gpr_mu_unlock(&s->mu);
diff --git a/src/ruby/spec/client_server_spec.rb b/src/ruby/spec/client_server_spec.rb
index f5acae896a..1321727f5c 100644
--- a/src/ruby/spec/client_server_spec.rb
+++ b/src/ruby/spec/client_server_spec.rb
@@ -362,9 +362,11 @@ describe 'the secure http client/server' do
@server.close
end
- it_behaves_like 'basic GRPC message delivery is OK' do
- end
+ # TODO: uncomment after updating the to the new c api
+ # it_behaves_like 'basic GRPC message delivery is OK' do
+ # end
- it_behaves_like 'GRPC metadata delivery works OK' do
- end
+ # TODO: uncomment after updating the to the new c api
+ # it_behaves_like 'GRPC metadata delivery works OK' do
+ # end
end
diff --git a/test/core/fling/client.c b/test/core/fling/client.c
index 6262699631..0a113f033f 100644
--- a/test/core/fling/client.c
+++ b/test/core/fling/client.c
@@ -55,7 +55,6 @@ static grpc_op stream_step_ops[2];
static grpc_metadata_array initial_metadata_recv;
static grpc_metadata_array trailing_metadata_recv;
static grpc_byte_buffer *response_payload_recv = NULL;
-static grpc_call_details call_details;
static grpc_status_code status;
static char *details = NULL;
static size_t details_capacity = 0;
@@ -64,7 +63,6 @@ static grpc_op *op;
static void init_ping_pong_request(void) {
grpc_metadata_array_init(&initial_metadata_recv);
grpc_metadata_array_init(&trailing_metadata_recv);
- grpc_call_details_init(&call_details);
op = ops;
@@ -97,6 +95,7 @@ static void step_ping_pong_request(void) {
grpc_call_start_batch(call, ops, op - ops, (void *)1));
grpc_event_finish(grpc_completion_queue_next(cq, gpr_inf_future));
grpc_call_destroy(call);
+ grpc_byte_buffer_destroy(response_payload_recv);
call = NULL;
}
@@ -121,6 +120,7 @@ static void step_ping_pong_stream(void) {
GPR_ASSERT(GRPC_CALL_OK ==
grpc_call_start_batch(call, stream_step_ops, 2, (void *)1));
grpc_event_finish(grpc_completion_queue_next(cq, gpr_inf_future));
+ grpc_byte_buffer_destroy(response_payload_recv);
}
static double now(void) {
diff --git a/test/core/fling/server.c b/test/core/fling/server.c
index bc52059b38..ca0683fa67 100644
--- a/test/core/fling/server.c
+++ b/test/core/fling/server.c
@@ -87,7 +87,6 @@ typedef struct {
static void request_call(void) {
grpc_metadata_array_init(&request_metadata_recv);
- grpc_call_details_init(&call_details);
grpc_server_request_call(server, &call, &call_details, &request_metadata_recv,
cq, tag(FLING_SERVER_NEW_REQUEST));
}
@@ -218,6 +217,8 @@ int main(int argc, char **argv) {
gpr_free(addr_buf);
addr = addr_buf = NULL;
+ grpc_call_details_init(&call_details);
+
request_call();
grpc_profiler_start("server.prof");
@@ -264,6 +265,8 @@ int main(int argc, char **argv) {
break;
case FLING_SERVER_WRITE_FOR_STREAMING:
/* Write completed at server */
+ grpc_byte_buffer_destroy(payload_buffer);
+ payload_buffer = NULL;
start_read_op(FLING_SERVER_READ_FOR_STREAMING);
break;
case FLING_SERVER_SEND_INIT_METADATA_FOR_STREAMING:
@@ -282,6 +285,8 @@ int main(int argc, char **argv) {
break;
case FLING_SERVER_BATCH_OPS_FOR_UNARY:
/* Finished unary call. */
+ grpc_byte_buffer_destroy(payload_buffer);
+ payload_buffer = NULL;
grpc_call_destroy(call);
request_call();
break;
@@ -305,6 +310,7 @@ int main(int argc, char **argv) {
grpc_event_finish(ev);
}
grpc_profiler_stop();
+ grpc_call_details_destroy(&call_details);
grpc_server_destroy(server);
grpc_completion_queue_destroy(cq);
diff --git a/test/core/transport/metadata_test.c b/test/core/transport/metadata_test.c
index b23db894be..a2d190e1c4 100644
--- a/test/core/transport/metadata_test.c
+++ b/test/core/transport/metadata_test.c
@@ -44,7 +44,7 @@
#define LOG_TEST() gpr_log(GPR_INFO, "%s", __FUNCTION__)
/* a large number */
-#define MANY 1000000
+#define MANY 100000
static void test_no_op(void) {
grpc_mdctx *ctx;