Merge branch 'c++api' of github.com:ctiller/grpc into c++api

pull/501/head
Yang Gao 10 years ago
commit 0b7c4d29d4
  1. 6
      src/core/channel/connected_channel.c
  2. 13
      src/core/iomgr/tcp_server_posix.c
  3. 10
      src/ruby/spec/client_server_spec.rb
  4. 4
      test/core/fling/client.c
  5. 8
      test/core/fling/server.c
  6. 2
      test/core/transport/metadata_test.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;

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

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

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

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

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

Loading…
Cancel
Save