clang-format, fix headers, windows fixes

pull/6610/head
Adam Michalik 9 years ago
parent b97e2d145e
commit 4ad746e4e0
  1. 6
      include/grpc++/create_channel_posix.h
  2. 4
      include/grpc++/server_posix.h
  3. 1
      include/grpc/grpc_posix.h
  4. 30
      src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c
  5. 9
      src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c
  6. 2
      src/core/ext/transport/chttp2/transport/internal.h
  7. 4
      src/core/ext/transport/chttp2/transport/parsing.c
  8. 5
      src/core/lib/support/avl.c
  9. 5
      src/cpp/client/create_channel_posix.cc
  10. 8
      src/cpp/server/server.cc
  11. 6
      src/cpp/server/server_posix.cc
  12. 10
      test/core/end2end/fixtures/h2_fd.c
  13. 2
      test/core/statistics/census_log_tests.c

@ -36,8 +36,8 @@
#include <memory>
#include <grpc/support/port_platform.h>
#include <grpc++/channel.h>
#include <grpc/support/port_platform.h>
namespace grpc {
@ -47,8 +47,8 @@ namespace grpc {
///
/// \param target The name of the target.
/// \param fd The file descriptor representing a socket.
std::shared_ptr<Channel> CreateInsecureChannelFromFd(
const grpc::string& target, int fd);
std::shared_ptr<Channel> CreateInsecureChannelFromFd(const grpc::string& target,
int fd);
#endif // GPR_SUPPORT_CHANNELS_FROM_FD

@ -36,8 +36,8 @@
#include <memory>
#include <grpc/support/port_platform.h>
#include <grpc++/server.h>
#include <grpc/support/port_platform.h>
namespace grpc {
@ -53,4 +53,4 @@ void AddInsecureChannelFromFd(Server* server, int fd);
} // namespace grpc
#endif // GRPCXX_CREATE_CHANNEL_POSIX_H
#endif // GRPCXX_SERVER_POSIX_H

@ -34,7 +34,6 @@
#ifndef GRPC_GRPC_POSIX_H
#define GRPC_GRPC_POSIX_H
#include <grpc/impl/codegen/grpc_types.h>
#include <grpc/support/port_platform.h>

@ -41,34 +41,32 @@
#include "src/core/ext/transport/chttp2/transport/chttp2_transport.h"
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/transport/transport.h"
#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/iomgr/endpoint.h"
#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/iomgr/tcp_posix.h"
#include "src/core/lib/surface/api_trace.h"
#include "src/core/lib/surface/channel.h"
#include "src/core/lib/transport/transport.h"
grpc_channel *grpc_insecure_channel_create_from_fd(
const char *target, int fd, const grpc_channel_args *args) {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
GRPC_API_TRACE(
"grpc_insecure_channel_create(target=%p, fd=%d, args=%p)", 3,
(target, fd, args));
GRPC_API_TRACE("grpc_insecure_channel_create(target=%p, fd=%d, args=%p)", 3,
(target, fd, args));
grpc_arg default_authority_arg;
default_authority_arg.type = GRPC_ARG_STRING;
default_authority_arg.key = GRPC_ARG_DEFAULT_AUTHORITY;
default_authority_arg.value.string = "test.authority";
grpc_channel_args *final_args = grpc_channel_args_copy_and_add(
args, &default_authority_arg, 1);
grpc_channel_args *final_args =
grpc_channel_args_copy_and_add(args, &default_authority_arg, 1);
int flags = fcntl(fd, F_GETFL, 0);
GPR_ASSERT(fcntl(fd, F_SETFL, flags | O_NONBLOCK) == 0);
grpc_endpoint *client = grpc_tcp_create(
grpc_fd_create(fd, "client"), GRPC_TCP_DEFAULT_READ_SLICE_SIZE,
"fd-client");
grpc_endpoint *client =
grpc_tcp_create(grpc_fd_create(fd, "client"),
GRPC_TCP_DEFAULT_READ_SLICE_SIZE, "fd-client");
grpc_transport *transport =
grpc_create_chttp2_transport(&exec_ctx, final_args, client, 1);
@ -85,4 +83,12 @@ grpc_channel *grpc_insecure_channel_create_from_fd(
"Failed to create client channel");
}
#endif // GPR_SUPPORT_CHANNELS_FROM_FD
#else // !GPR_SUPPORT_CHANNELS_FROM_FD
grpc_channel *grpc_insecure_channel_create_from_fd(
const char *target, int fd, const grpc_channel_args *args) {
GPR_ASSERT(0);
return NULL;
}
#endif // GPR_SUPPORT_CHANNELS_FROM_FD

@ -66,5 +66,12 @@ void grpc_server_add_insecure_channel_from_fd(grpc_server *server,
grpc_exec_ctx_finish(&exec_ctx);
}
#else // !GPR_SUPPORT_CHANNELS_FROM_FD
#endif // GPR_SUPPORT_CHANNELS_FROM_FD
void grpc_server_add_insecure_channel_from_fd(grpc_server *server,
grpc_completion_queue *cq,
int fd) {
GPR_ASSERT(0);
}
#endif // GPR_SUPPORT_CHANNELS_FROM_FD

@ -691,7 +691,7 @@ extern int grpc_flowctl_trace;
if (!(grpc_http_trace)) \
; \
else \
stmt
stmt
typedef enum {
GRPC_CHTTP2_FLOWCTL_MOVE,

@ -87,8 +87,8 @@ void grpc_chttp2_prepare_to_read(
transport_global->settings[GRPC_SENT_SETTINGS],
sizeof(transport_parsing->last_sent_settings));
transport_parsing->max_frame_size =
transport_global->settings[GRPC_ACKED_SETTINGS]
[GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE];
transport_global
->settings[GRPC_ACKED_SETTINGS][GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE];
/* update the parsing view of incoming window */
while (grpc_chttp2_list_pop_unannounced_incoming_window_available(

@ -73,8 +73,9 @@ static long node_height(gpr_avl_node *node) {
#ifndef NDEBUG
static long calculate_height(gpr_avl_node *node) {
return node == NULL ? 0 : 1 + GPR_MAX(calculate_height(node->left),
calculate_height(node->right));
return node == NULL ? 0
: 1 + GPR_MAX(calculate_height(node->left),
calculate_height(node->right));
}
static gpr_avl_node *assert_invariants(gpr_avl_node *n) {

@ -31,7 +31,6 @@
*
*/
#include <grpc++/channel.h>
#include <grpc++/create_channel.h>
#include <grpc++/impl/grpc_library.h>
@ -44,8 +43,8 @@ namespace grpc {
#ifdef GPR_SUPPORT_CHANNELS_FROM_FD
std::shared_ptr<Channel> CreateInsecureChannelFromFd(
const grpc::string& target, int fd) {
std::shared_ptr<Channel> CreateInsecureChannelFromFd(const grpc::string& target,
int fd) {
internal::GrpcLibrary init_lib;
init_lib.init();
return CreateChannelInternal(

@ -329,13 +329,9 @@ void Server::SetGlobalCallbacks(GlobalCallbacks* callbacks) {
g_callbacks.reset(callbacks);
}
grpc_server* Server::c_server() {
return server_;
}
grpc_server* Server::c_server() { return server_; }
CompletionQueue* Server::completion_queue() {
return &cq_;
}
CompletionQueue* Server::completion_queue() { return &cq_; }
static grpc_server_register_method_payload_handling PayloadHandlingForMethod(
RpcServiceMethod* method) {

@ -40,12 +40,10 @@ namespace grpc {
#ifdef GPR_SUPPORT_CHANNELS_FROM_FD
void AddInsecureChannelFromFd(Server* server, int fd) {
grpc_server_add_insecure_channel_from_fd(server->c_server(),
server->completion_queue()->cq(),
fd);
grpc_server_add_insecure_channel_from_fd(
server->c_server(), server->completion_queue()->cq(), fd);
#endif // GPR_SUPPORT_CHANNELS_FROM_FD
}
} // namespace grpc

@ -36,18 +36,16 @@
#include <fcntl.h>
#include <string.h>
#include <grpc/support/alloc.h>
#include <grpc/grpc.h>
#include <grpc/grpc_posix.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include "src/core/lib/iomgr/socket_utils_posix.h"
#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/iomgr/socket_utils_posix.h"
#include "src/core/lib/iomgr/unix_sockets_posix.h"
#include "test/core/util/test_config.h"
typedef struct {
int fd_pair[2];
} sp_fixture_data;
typedef struct { int fd_pair[2]; } sp_fixture_data;
static void create_sockets(int sv[2]) {
int flags;
@ -62,7 +60,7 @@ static void create_sockets(int sv[2]) {
static grpc_end2end_test_fixture chttp2_create_fixture_socketpair(
grpc_channel_args *client_args, grpc_channel_args *server_args) {
sp_fixture_data* fixture_data = gpr_malloc(sizeof(*fixture_data));
sp_fixture_data *fixture_data = gpr_malloc(sizeof(*fixture_data));
grpc_end2end_test_fixture f;
memset(&f, 0, sizeof(f));

@ -31,7 +31,6 @@
*
*/
#include "src/core/ext/census/census_log.h"
#include <grpc/support/cpu.h>
#include <grpc/support/log.h>
#include <grpc/support/port_platform.h>
@ -42,6 +41,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "src/core/ext/census/census_log.h"
#include "test/core/util/test_config.h"
/* Fills in 'record' of size 'size'. Each byte in record is filled in with the

Loading…
Cancel
Save