Merge github.com:google/grpc into nogo
This commit is contained in:
commit
3d829d8bf4
|
|
@ -0,0 +1,65 @@
|
|||
---
|
||||
Language: Cpp
|
||||
# BasedOnStyle: Google
|
||||
AccessModifierOffset: -1
|
||||
AlignAfterOpenBracket: true
|
||||
AlignEscapedNewlinesLeft: true
|
||||
AlignOperands: true
|
||||
AlignTrailingComments: true
|
||||
AllowAllParametersOfDeclarationOnNextLine: true
|
||||
AllowShortBlocksOnASingleLine: false
|
||||
AllowShortCaseLabelsOnASingleLine: false
|
||||
AllowShortIfStatementsOnASingleLine: true
|
||||
AllowShortLoopsOnASingleLine: true
|
||||
AllowShortFunctionsOnASingleLine: All
|
||||
AlwaysBreakAfterDefinitionReturnType: false
|
||||
AlwaysBreakTemplateDeclarations: true
|
||||
AlwaysBreakBeforeMultilineStrings: true
|
||||
BreakBeforeBinaryOperators: None
|
||||
BreakBeforeTernaryOperators: true
|
||||
BreakConstructorInitializersBeforeComma: false
|
||||
BinPackParameters: true
|
||||
BinPackArguments: true
|
||||
ColumnLimit: 80
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: true
|
||||
ConstructorInitializerIndentWidth: 4
|
||||
DerivePointerAlignment: true
|
||||
ExperimentalAutoDetectBinPacking: false
|
||||
IndentCaseLabels: true
|
||||
IndentWrappedFunctionNames: false
|
||||
IndentFunctionDeclarationAfterType: false
|
||||
MaxEmptyLinesToKeep: 1
|
||||
KeepEmptyLinesAtTheStartOfBlocks: false
|
||||
NamespaceIndentation: None
|
||||
ObjCBlockIndentWidth: 2
|
||||
ObjCSpaceAfterProperty: false
|
||||
ObjCSpaceBeforeProtocolList: false
|
||||
PenaltyBreakBeforeFirstCallParameter: 1
|
||||
PenaltyBreakComment: 300
|
||||
PenaltyBreakString: 1000
|
||||
PenaltyBreakFirstLessLess: 120
|
||||
PenaltyExcessCharacter: 1000000
|
||||
PenaltyReturnTypeOnItsOwnLine: 200
|
||||
PointerAlignment: Left
|
||||
SpacesBeforeTrailingComments: 2
|
||||
Cpp11BracedListStyle: true
|
||||
Standard: Auto
|
||||
IndentWidth: 2
|
||||
TabWidth: 8
|
||||
UseTab: Never
|
||||
BreakBeforeBraces: Attach
|
||||
SpacesInParentheses: false
|
||||
SpacesInSquareBrackets: false
|
||||
SpacesInAngles: false
|
||||
SpaceInEmptyParentheses: false
|
||||
SpacesInCStyleCastParentheses: false
|
||||
SpaceAfterCStyleCast: false
|
||||
SpacesInContainerLiterals: true
|
||||
SpaceBeforeAssignmentOperators: true
|
||||
ContinuationIndentWidth: 4
|
||||
CommentPragmas: '^ IWYU pragma:'
|
||||
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
|
||||
SpaceBeforeParens: ControlStatements
|
||||
DisableFormat: false
|
||||
...
|
||||
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
bins
|
||||
deps
|
||||
libs
|
||||
objs
|
||||
*.pyc
|
||||
|
||||
15
build.json
15
build.json
|
|
@ -1322,6 +1322,7 @@
|
|||
"test/cpp/end2end/sync_client_async_server_test.cc"
|
||||
],
|
||||
"deps": [
|
||||
"grpc++_test_util",
|
||||
"grpc_test_util",
|
||||
"grpc++",
|
||||
"grpc",
|
||||
|
|
@ -1334,9 +1335,7 @@
|
|||
"build": "test",
|
||||
"c++": true,
|
||||
"src": [
|
||||
"test/cpp/interop/empty.proto",
|
||||
"test/cpp/interop/messages.proto",
|
||||
"test/cpp/interop/test.proto",
|
||||
"test/cpp/qps/qpstest.proto",
|
||||
"test/cpp/qps/client.cc"
|
||||
],
|
||||
"deps": [
|
||||
|
|
@ -1353,9 +1352,7 @@
|
|||
"build": "test",
|
||||
"c++": true,
|
||||
"src": [
|
||||
"test/cpp/interop/empty.proto",
|
||||
"test/cpp/interop/messages.proto",
|
||||
"test/cpp/interop/test.proto",
|
||||
"test/cpp/qps/qpstest.proto",
|
||||
"test/cpp/qps/server.cc"
|
||||
],
|
||||
"deps": [
|
||||
|
|
@ -1432,7 +1429,8 @@
|
|||
],
|
||||
"deps": [
|
||||
"grpc++",
|
||||
"grpc"
|
||||
"grpc",
|
||||
"gpr"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
@ -1444,7 +1442,8 @@
|
|||
],
|
||||
"deps": [
|
||||
"grpc++",
|
||||
"grpc"
|
||||
"grpc",
|
||||
"gpr"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ class AsyncServerContext {
|
|||
system_clock::time_point absolute_deadline_;
|
||||
|
||||
google::protobuf::Message* request_; // not owned
|
||||
grpc_call* call_; // owned
|
||||
grpc_call* call_; // owned
|
||||
};
|
||||
|
||||
} // namespace grpc
|
||||
|
|
|
|||
|
|
@ -57,10 +57,10 @@ class ChannelInterface {
|
|||
const google::protobuf::Message& request,
|
||||
google::protobuf::Message* result) = 0;
|
||||
|
||||
virtual StreamContextInterface* CreateStream(const RpcMethod& method,
|
||||
ClientContext* context,
|
||||
const google::protobuf::Message* request,
|
||||
google::protobuf::Message* result) = 0;
|
||||
virtual StreamContextInterface* CreateStream(
|
||||
const RpcMethod& method, ClientContext* context,
|
||||
const google::protobuf::Message* request,
|
||||
google::protobuf::Message* result) = 0;
|
||||
};
|
||||
|
||||
} // namespace grpc
|
||||
|
|
|
|||
|
|
@ -39,7 +39,6 @@
|
|||
namespace grpc {
|
||||
|
||||
typedef std::string string;
|
||||
|
||||
}
|
||||
|
||||
#endif // __GRPCPP_CONFIG_H__
|
||||
|
|
|
|||
|
|
@ -112,7 +112,6 @@ class CredentialsFactory {
|
|||
const grpc::string& authorization_token,
|
||||
const grpc::string& authority_selector);
|
||||
|
||||
|
||||
// Combines two credentials objects into a composite credentials
|
||||
static std::unique_ptr<Credentials> ComposeCredentials(
|
||||
const std::unique_ptr<Credentials>& creds1,
|
||||
|
|
|
|||
|
|
@ -55,14 +55,17 @@ class MethodHandler {
|
|||
public:
|
||||
virtual ~MethodHandler() {}
|
||||
struct HandlerParameter {
|
||||
HandlerParameter(ServerContext* context, const google::protobuf::Message* req,
|
||||
HandlerParameter(ServerContext* context,
|
||||
const google::protobuf::Message* req,
|
||||
google::protobuf::Message* resp)
|
||||
: server_context(context),
|
||||
request(req),
|
||||
response(resp),
|
||||
stream_context(nullptr) {}
|
||||
HandlerParameter(ServerContext* context, const google::protobuf::Message* req,
|
||||
google::protobuf::Message* resp, StreamContextInterface* stream)
|
||||
HandlerParameter(ServerContext* context,
|
||||
const google::protobuf::Message* req,
|
||||
google::protobuf::Message* resp,
|
||||
StreamContextInterface* stream)
|
||||
: server_context(context),
|
||||
request(req),
|
||||
response(resp),
|
||||
|
|
@ -171,7 +174,8 @@ class RpcServiceMethod : public RpcMethod {
|
|||
public:
|
||||
// Takes ownership of the handler and two prototype objects.
|
||||
RpcServiceMethod(const char* name, RpcMethod::RpcType type,
|
||||
MethodHandler* handler, google::protobuf::Message* request_prototype,
|
||||
MethodHandler* handler,
|
||||
google::protobuf::Message* request_prototype,
|
||||
google::protobuf::Message* response_prototype)
|
||||
: RpcMethod(name, type),
|
||||
handler_(handler),
|
||||
|
|
@ -180,7 +184,9 @@ class RpcServiceMethod : public RpcMethod {
|
|||
|
||||
MethodHandler* handler() { return handler_.get(); }
|
||||
|
||||
google::protobuf::Message* AllocateRequestProto() { return request_prototype_->New(); }
|
||||
google::protobuf::Message* AllocateRequestProto() {
|
||||
return request_prototype_->New();
|
||||
}
|
||||
google::protobuf::Message* AllocateResponseProto() {
|
||||
return response_prototype_->New();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@
|
|||
#ifndef __GRPCPP_STATUS_CODE_ENUM_H__
|
||||
#define __GRPCPP_STATUS_CODE_ENUM_H__
|
||||
|
||||
|
||||
namespace grpc {
|
||||
|
||||
enum StatusCode {
|
||||
|
|
|
|||
|
|
@ -47,4 +47,4 @@ struct grpc_byte_buffer {
|
|||
} data;
|
||||
};
|
||||
|
||||
#endif /* __GRPC_BYTE_BUFFER_H__ */
|
||||
#endif /* __GRPC_BYTE_BUFFER_H__ */
|
||||
|
|
|
|||
|
|
@ -46,4 +46,4 @@ struct grpc_byte_buffer_reader {
|
|||
} current;
|
||||
};
|
||||
|
||||
#endif /* __GRPC_BYTE_BUFFER_READER_H__ */
|
||||
#endif /* __GRPC_BYTE_BUFFER_READER_H__ */
|
||||
|
|
|
|||
|
|
@ -453,4 +453,4 @@ void grpc_server_destroy(grpc_server *server);
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif /* __GRPC_GRPC_H__ */
|
||||
#endif /* __GRPC_GRPC_H__ */
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@
|
|||
#ifndef __GRPC_STATUS_H__
|
||||
#define __GRPC_STATUS_H__
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
|
@ -200,4 +199,4 @@ typedef enum {
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif /* __GRPC_STATUS_H__ */
|
||||
#endif /* __GRPC_STATUS_H__ */
|
||||
|
|
|
|||
|
|
@ -55,4 +55,4 @@ void gpr_free_aligned(void *ptr);
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif /* __GRPC_SUPPORT_ALLOC_H__ */
|
||||
#endif /* __GRPC_SUPPORT_ALLOC_H__ */
|
||||
|
|
|
|||
|
|
@ -89,4 +89,4 @@
|
|||
#error could not determine platform for atm
|
||||
#endif
|
||||
|
||||
#endif /* __GRPC_SUPPORT_ATM_H__ */
|
||||
#endif /* __GRPC_SUPPORT_ATM_H__ */
|
||||
|
|
|
|||
|
|
@ -66,4 +66,4 @@ static __inline int gpr_atm_rel_cas(gpr_atm *p, gpr_atm o, gpr_atm n) {
|
|||
__ATOMIC_RELAXED);
|
||||
}
|
||||
|
||||
#endif /* __GRPC_SUPPORT_ATM_GCC_ATOMIC_H__ */
|
||||
#endif /* __GRPC_SUPPORT_ATM_GCC_ATOMIC_H__ */
|
||||
|
|
|
|||
|
|
@ -70,4 +70,4 @@ static __inline void gpr_atm_rel_store(gpr_atm *p, gpr_atm value) {
|
|||
#define gpr_atm_acq_cas(p, o, n) (__sync_bool_compare_and_swap((p), (o), (n)))
|
||||
#define gpr_atm_rel_cas(p, o, n) gpr_atm_acq_cas((p), (o), (n))
|
||||
|
||||
#endif /* __GRPC_SUPPORT_ATM_GCC_SYNC_H__ */
|
||||
#endif /* __GRPC_SUPPORT_ATM_GCC_SYNC_H__ */
|
||||
|
|
|
|||
|
|
@ -55,8 +55,8 @@ static __inline void gpr_atm_rel_store(gpr_atm *p, gpr_atm value) {
|
|||
}
|
||||
|
||||
static __inline int gpr_atm_no_barrier_cas(gpr_atm *p, gpr_atm o, gpr_atm n) {
|
||||
/* InterlockedCompareExchangePointerNoFence() not available on vista or
|
||||
windows7 */
|
||||
/* InterlockedCompareExchangePointerNoFence() not available on vista or
|
||||
windows7 */
|
||||
#ifdef GPR_ARCH_64
|
||||
return o == (gpr_atm)InterlockedCompareExchangeAcquire64(p, n, o);
|
||||
#else
|
||||
|
|
|
|||
|
|
@ -53,4 +53,4 @@ typedef struct {
|
|||
struct gpr_cancellable_list_ waiters;
|
||||
} gpr_cancellable;
|
||||
|
||||
#endif /* __GRPC_SUPPORT_CANCELLABLE_PLATFORM_H__ */
|
||||
#endif /* __GRPC_SUPPORT_CANCELLABLE_PLATFORM_H__ */
|
||||
|
|
|
|||
|
|
@ -92,4 +92,4 @@ void gpr_cmdline_destroy(gpr_cmdline *cl);
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif /* __GRPC_SUPPORT_CMDLINE_H__ */
|
||||
#endif /* __GRPC_SUPPORT_CMDLINE_H__ */
|
||||
|
|
|
|||
|
|
@ -63,4 +63,4 @@ double gpr_histogram_sum_of_squares(gpr_histogram *histogram);
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif /* __GRPC_SUPPORT_HISTOGRAM_H__ */
|
||||
#endif /* __GRPC_SUPPORT_HISTOGRAM_H__ */
|
||||
|
|
|
|||
|
|
@ -105,4 +105,4 @@ void gpr_set_log_function(gpr_log_func func);
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif /* __GRPC_SUPPORT_LOG_H__ */
|
||||
#endif /* __GRPC_SUPPORT_LOG_H__ */
|
||||
|
|
|
|||
|
|
@ -173,4 +173,4 @@ int gpr_slice_str_cmp(gpr_slice a, const char *b);
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif /* __GRPC_SUPPORT_SLICE_H__ */
|
||||
#endif /* __GRPC_SUPPORT_SLICE_H__ */
|
||||
|
|
|
|||
|
|
@ -81,4 +81,4 @@ void gpr_slice_buffer_reset_and_unref(gpr_slice_buffer *sb);
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif /* __GRPC_SUPPORT_SLICE_BUFFER_H__ */
|
||||
#endif /* __GRPC_SUPPORT_SLICE_BUFFER_H__ */
|
||||
|
|
|
|||
|
|
@ -74,4 +74,4 @@ int gpr_asprintf(char **strp, const char *format, ...);
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif /* __GRPC_SUPPORT_STRING_H__ */
|
||||
#endif /* __GRPC_SUPPORT_STRING_H__ */
|
||||
|
|
|
|||
|
|
@ -345,4 +345,4 @@ gpr_intptr gpr_stats_read(const gpr_stats_counter *c);
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif /* __GRPC_SUPPORT_SYNC_H__ */
|
||||
#endif /* __GRPC_SUPPORT_SYNC_H__ */
|
||||
|
|
|
|||
|
|
@ -52,4 +52,4 @@ typedef struct { gpr_atm value; } gpr_stats_counter;
|
|||
#define GPR_STATS_INIT \
|
||||
{ 0 }
|
||||
|
||||
#endif /* __GRPC_SUPPORT_SYNC_GENERIC_H__ */
|
||||
#endif /* __GRPC_SUPPORT_SYNC_GENERIC_H__ */
|
||||
|
|
|
|||
|
|
@ -45,4 +45,4 @@ typedef pthread_once_t gpr_once;
|
|||
|
||||
#define GPR_ONCE_INIT PTHREAD_ONCE_INIT
|
||||
|
||||
#endif /* __GRPC_SUPPORT_SYNC_POSIX_H__ */
|
||||
#endif /* __GRPC_SUPPORT_SYNC_POSIX_H__ */
|
||||
|
|
|
|||
|
|
@ -49,4 +49,4 @@ typedef CONDITION_VARIABLE gpr_cv;
|
|||
typedef INIT_ONCE gpr_once;
|
||||
#define GPR_ONCE_INIT INIT_ONCE_STATIC_INIT
|
||||
|
||||
#endif /* __GRPC_SUPPORT_SYNC_WIN32_H__ */
|
||||
#endif /* __GRPC_SUPPORT_SYNC_WIN32_H__ */
|
||||
|
|
|
|||
|
|
@ -76,4 +76,4 @@ gpr_thd_options gpr_thd_options_default(void);
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif /* __GRPC_SUPPORT_THD_H__ */
|
||||
#endif /* __GRPC_SUPPORT_THD_H__ */
|
||||
|
|
|
|||
|
|
@ -39,4 +39,4 @@
|
|||
|
||||
typedef pthread_t gpr_thd_id;
|
||||
|
||||
#endif /* __GRPC_SUPPORT_THD_POSIX_H__ */
|
||||
#endif /* __GRPC_SUPPORT_THD_POSIX_H__ */
|
||||
|
|
|
|||
|
|
@ -41,4 +41,4 @@
|
|||
|
||||
typedef int gpr_thd_id;
|
||||
|
||||
#endif /* __GRPC_SUPPORT_THD_WIN32_H__ */
|
||||
#endif /* __GRPC_SUPPORT_THD_WIN32_H__ */
|
||||
|
|
|
|||
|
|
@ -113,4 +113,4 @@ double gpr_timespec_to_micros(gpr_timespec t);
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif /* __GRPC_SUPPORT_TIME_H__ */
|
||||
#endif /* __GRPC_SUPPORT_TIME_H__ */
|
||||
|
|
|
|||
|
|
@ -40,4 +40,4 @@
|
|||
|
||||
typedef struct timespec gpr_timespec;
|
||||
|
||||
#endif /* __GRPC_SUPPORT_TIME_POSIX_H__ */
|
||||
#endif /* __GRPC_SUPPORT_TIME_POSIX_H__ */
|
||||
|
|
|
|||
|
|
@ -43,4 +43,4 @@ typedef struct gpr_timespec {
|
|||
long tv_nsec;
|
||||
} gpr_timespec;
|
||||
|
||||
#endif /* __GRPC_SUPPORT_TIME_WIN32_H__ */
|
||||
#endif /* __GRPC_SUPPORT_TIME_WIN32_H__ */
|
||||
|
|
|
|||
|
|
@ -45,4 +45,4 @@
|
|||
|
||||
#define GPR_ARRAY_SIZE(array) (sizeof(array) / sizeof(*(array)))
|
||||
|
||||
#endif /* __GRPC_SUPPORT_USEFUL_H__ */
|
||||
#endif /* __GRPC_SUPPORT_USEFUL_H__ */
|
||||
|
|
|
|||
|
|
@ -43,13 +43,11 @@ namespace grpc_cpp_generator {
|
|||
namespace {
|
||||
|
||||
bool NoStreaming(const google::protobuf::MethodDescriptor* method) {
|
||||
return !method->client_streaming() &&
|
||||
!method->server_streaming();
|
||||
return !method->client_streaming() && !method->server_streaming();
|
||||
}
|
||||
|
||||
bool ClientOnlyStreaming(const google::protobuf::MethodDescriptor* method) {
|
||||
return method->client_streaming() &&
|
||||
!method->server_streaming();
|
||||
return method->client_streaming() && !method->server_streaming();
|
||||
}
|
||||
|
||||
bool ServerOnlyStreaming(const google::protobuf::MethodDescriptor* method) {
|
||||
|
|
@ -57,8 +55,7 @@ bool ServerOnlyStreaming(const google::protobuf::MethodDescriptor* method) {
|
|||
}
|
||||
|
||||
bool BidiStreaming(const google::protobuf::MethodDescriptor* method) {
|
||||
return method->client_streaming() &&
|
||||
method->server_streaming();
|
||||
return method->client_streaming() && method->server_streaming();
|
||||
}
|
||||
|
||||
bool HasClientOnlyStreaming(const google::protobuf::FileDescriptor* file) {
|
||||
|
|
@ -132,8 +129,8 @@ string GetSourceIncludes() {
|
|||
}
|
||||
|
||||
void PrintHeaderClientMethod(google::protobuf::io::Printer* printer,
|
||||
const google::protobuf::MethodDescriptor* method,
|
||||
map<string, string>* vars) {
|
||||
const google::protobuf::MethodDescriptor* method,
|
||||
map<string, string>* vars) {
|
||||
(*vars)["Method"] = method->name();
|
||||
(*vars)["Request"] =
|
||||
grpc_cpp_generator::ClassName(method->input_type(), true);
|
||||
|
|
@ -204,8 +201,9 @@ void PrintHeaderService(google::protobuf::io::Printer* printer,
|
|||
printer->Indent();
|
||||
|
||||
// Client side
|
||||
printer->Print("class Stub : public ::grpc::InternalStub {\n"
|
||||
" public:\n");
|
||||
printer->Print(
|
||||
"class Stub : public ::grpc::InternalStub {\n"
|
||||
" public:\n");
|
||||
printer->Indent();
|
||||
for (int i = 0; i < service->method_count(); ++i) {
|
||||
PrintHeaderClientMethod(printer, service->method(i), vars);
|
||||
|
|
@ -219,8 +217,9 @@ void PrintHeaderService(google::protobuf::io::Printer* printer,
|
|||
printer->Print("\n");
|
||||
|
||||
// Server side
|
||||
printer->Print("class Service {\n"
|
||||
" public:\n");
|
||||
printer->Print(
|
||||
"class Service {\n"
|
||||
" public:\n");
|
||||
printer->Indent();
|
||||
printer->Print("Service() : service_(nullptr) {}\n");
|
||||
printer->Print("virtual ~Service();\n");
|
||||
|
|
@ -229,8 +228,9 @@ void PrintHeaderService(google::protobuf::io::Printer* printer,
|
|||
}
|
||||
printer->Print("::grpc::RpcService* service();\n");
|
||||
printer->Outdent();
|
||||
printer->Print(" private:\n"
|
||||
" ::grpc::RpcService* service_;\n");
|
||||
printer->Print(
|
||||
" private:\n"
|
||||
" ::grpc::RpcService* service_;\n");
|
||||
printer->Print("};\n");
|
||||
|
||||
printer->Outdent();
|
||||
|
|
@ -251,8 +251,8 @@ string GetHeaderServices(const google::protobuf::FileDescriptor* file) {
|
|||
}
|
||||
|
||||
void PrintSourceClientMethod(google::protobuf::io::Printer* printer,
|
||||
const google::protobuf::MethodDescriptor* method,
|
||||
map<string, string>* vars) {
|
||||
const google::protobuf::MethodDescriptor* method,
|
||||
map<string, string>* vars) {
|
||||
(*vars)["Method"] = method->name();
|
||||
(*vars)["Request"] =
|
||||
grpc_cpp_generator::ClassName(method->input_type(), true);
|
||||
|
|
@ -308,8 +308,8 @@ void PrintSourceClientMethod(google::protobuf::io::Printer* printer,
|
|||
}
|
||||
|
||||
void PrintSourceServerMethod(google::protobuf::io::Printer* printer,
|
||||
const google::protobuf::MethodDescriptor* method,
|
||||
map<string, string>* vars) {
|
||||
const google::protobuf::MethodDescriptor* method,
|
||||
map<string, string>* vars) {
|
||||
(*vars)["Method"] = method->name();
|
||||
(*vars)["Request"] =
|
||||
grpc_cpp_generator::ClassName(method->input_type(), true);
|
||||
|
|
@ -362,12 +362,12 @@ void PrintSourceService(google::protobuf::io::Printer* printer,
|
|||
map<string, string>* vars) {
|
||||
(*vars)["Service"] = service->name();
|
||||
printer->Print(*vars,
|
||||
"$Service$::Stub* $Service$::NewStub("
|
||||
"const std::shared_ptr<::grpc::ChannelInterface>& channel) {\n"
|
||||
" $Service$::Stub* stub = new $Service$::Stub();\n"
|
||||
" stub->set_channel(channel);\n"
|
||||
" return stub;\n"
|
||||
"};\n\n");
|
||||
"$Service$::Stub* $Service$::NewStub("
|
||||
"const std::shared_ptr<::grpc::ChannelInterface>& channel) {\n"
|
||||
" $Service$::Stub* stub = new $Service$::Stub();\n"
|
||||
" stub->set_channel(channel);\n"
|
||||
" return stub;\n"
|
||||
"};\n\n");
|
||||
for (int i = 0; i < service->method_count(); ++i) {
|
||||
PrintSourceClientMethod(printer, service->method(i), vars);
|
||||
}
|
||||
|
|
@ -380,11 +380,12 @@ void PrintSourceService(google::protobuf::io::Printer* printer,
|
|||
PrintSourceServerMethod(printer, service->method(i), vars);
|
||||
}
|
||||
printer->Print(*vars,
|
||||
"::grpc::RpcService* $Service$::Service::service() {\n");
|
||||
"::grpc::RpcService* $Service$::Service::service() {\n");
|
||||
printer->Indent();
|
||||
printer->Print("if (service_ != nullptr) {\n"
|
||||
" return service_;\n"
|
||||
"}\n");
|
||||
printer->Print(
|
||||
"if (service_ != nullptr) {\n"
|
||||
" return service_;\n"
|
||||
"}\n");
|
||||
printer->Print("service_ = new ::grpc::RpcService();\n");
|
||||
for (int i = 0; i < service->method_count(); ++i) {
|
||||
const google::protobuf::MethodDescriptor* method = service->method(i);
|
||||
|
|
|
|||
|
|
@ -85,7 +85,8 @@ inline string DotsToUnderscores(const string& name) {
|
|||
return StringReplace(name, ".", "_");
|
||||
}
|
||||
|
||||
inline string ClassName(const google::protobuf::Descriptor* descriptor, bool qualified) {
|
||||
inline string ClassName(const google::protobuf::Descriptor* descriptor,
|
||||
bool qualified) {
|
||||
// Find "outer", the descriptor of the top-level message in which
|
||||
// "descriptor" is embedded.
|
||||
const google::protobuf::Descriptor* outer = descriptor;
|
||||
|
|
|
|||
|
|
@ -54,9 +54,10 @@ class CppGrpcGenerator : public google::protobuf::compiler::CodeGenerator {
|
|||
google::protobuf::compiler::GeneratorContext* context,
|
||||
string* error) const {
|
||||
if (file->options().cc_generic_services()) {
|
||||
*error = "cpp grpc proto compiler plugin does not work with generic "
|
||||
"services. To generate cpp grpc APIs, please set \""
|
||||
"cc_generic_service = false\".";
|
||||
*error =
|
||||
"cpp grpc proto compiler plugin does not work with generic "
|
||||
"services. To generate cpp grpc APIs, please set \""
|
||||
"cc_generic_service = false\".";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -67,9 +67,8 @@ void PrintMethod(const MethodDescriptor* method, const string& package,
|
|||
output_type = "stream(" + output_type + ")";
|
||||
}
|
||||
map<string, string> method_vars = ListToDict({
|
||||
"mth.name", method->name(),
|
||||
"input.type", input_type,
|
||||
"output.type", output_type,
|
||||
"mth.name", method->name(), "input.type", input_type, "output.type",
|
||||
output_type,
|
||||
});
|
||||
out->Print(method_vars, "rpc :$mth.name$, $input.type$, $output.type$\n");
|
||||
}
|
||||
|
|
@ -105,8 +104,7 @@ void PrintService(const ServiceDescriptor* service, const string& package,
|
|||
out->Print("self.marshal_class_method = :encode\n");
|
||||
out->Print("self.unmarshal_class_method = :decode\n");
|
||||
map<string, string> pkg_vars = ListToDict({
|
||||
"service.name", service->name(),
|
||||
"pkg.name", package,
|
||||
"service.name", service->name(), "pkg.name", package,
|
||||
});
|
||||
out->Print(pkg_vars, "self.service_name = '$pkg.name$.$service.name$'\n");
|
||||
out->Print("\n");
|
||||
|
|
@ -139,9 +137,8 @@ string GetServices(const FileDescriptor* file) {
|
|||
|
||||
// Write out a file header.
|
||||
map<string, string> header_comment_vars = ListToDict({
|
||||
"file.name", file->name(),
|
||||
"file.package", file->package(),
|
||||
});
|
||||
"file.name", file->name(), "file.package", file->package(),
|
||||
});
|
||||
out.Print("# Generated by the protocol buffer compiler. DO NOT EDIT!\n");
|
||||
out.Print(header_comment_vars,
|
||||
"# Source: $file.name$ for package '$file.package$'\n");
|
||||
|
|
|
|||
|
|
@ -47,8 +47,9 @@ inline bool ServicesFilename(const google::protobuf::FileDescriptor* file,
|
|||
static const unsigned proto_suffix_length = 6; // length of ".proto"
|
||||
if (file->name().size() > proto_suffix_length &&
|
||||
file->name().find_last_of(".proto") == file->name().size() - 1) {
|
||||
*file_name_or_error = file->name().substr(
|
||||
0, file->name().size() - proto_suffix_length) + "_services.rb";
|
||||
*file_name_or_error =
|
||||
file->name().substr(0, file->name().size() - proto_suffix_length) +
|
||||
"_services.rb";
|
||||
return true;
|
||||
} else {
|
||||
*file_name_or_error = "Invalid proto file name: must end with .proto";
|
||||
|
|
@ -56,7 +57,8 @@ inline bool ServicesFilename(const google::protobuf::FileDescriptor* file,
|
|||
}
|
||||
}
|
||||
|
||||
inline string MessagesRequireName(const google::protobuf::FileDescriptor* file) {
|
||||
inline string MessagesRequireName(
|
||||
const google::protobuf::FileDescriptor* file) {
|
||||
return Replace(file->name(), ".proto", "");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,6 @@
|
|||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
||||
using std::initializer_list;
|
||||
using std::map;
|
||||
using std::vector;
|
||||
|
|
@ -51,11 +50,12 @@ namespace grpc_ruby_generator {
|
|||
// into a map of key* to value*. Is merely a readability helper for later code.
|
||||
inline map<string, string> ListToDict(const initializer_list<string>& values) {
|
||||
if (values.size() % 2 != 0) {
|
||||
// MOE: insert std::cerr << "Not every 'key' has a value in `values`." << std::endl;
|
||||
// MOE: insert std::cerr << "Not every 'key' has a value in `values`."
|
||||
// << std::endl;
|
||||
}
|
||||
map<string, string> value_map;
|
||||
auto value_iter = values.begin();
|
||||
for (unsigned i = 0; i < values.size()/2; ++i) {
|
||||
for (unsigned i = 0; i < values.size() / 2; ++i) {
|
||||
string key = *value_iter;
|
||||
++value_iter;
|
||||
string value = *value_iter;
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ using std::transform;
|
|||
namespace grpc_ruby_generator {
|
||||
|
||||
// Split splits a string using char into elems.
|
||||
inline vector<string> &Split(const string &s, char delim,
|
||||
inline vector<string>& Split(const string& s, char delim,
|
||||
vector<string>* elems) {
|
||||
stringstream ss(s);
|
||||
string item;
|
||||
|
|
@ -56,7 +56,7 @@ inline vector<string> &Split(const string &s, char delim,
|
|||
}
|
||||
|
||||
// Split splits a string using char, returning the result in a vector.
|
||||
inline vector<string> Split(const string &s, char delim) {
|
||||
inline vector<string> Split(const string& s, char delim) {
|
||||
vector<string> elems;
|
||||
Split(s, delim, &elems);
|
||||
return elems;
|
||||
|
|
@ -106,7 +106,7 @@ inline string CapitalizeFirst(string s) {
|
|||
inline string RubyTypeOf(const string& a_type, const string& package) {
|
||||
string res(a_type);
|
||||
ReplacePrefix(&res, package, ""); // remove the leading package if present
|
||||
ReplacePrefix(&res, ".", ""); // remove the leading . (no package)
|
||||
ReplacePrefix(&res, ".", ""); // remove the leading . (no package)
|
||||
if (res.find('.') == string::npos) {
|
||||
return res;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -51,4 +51,4 @@ void grpc_channel_args_destroy(grpc_channel_args *a);
|
|||
is specified in channel args, otherwise returns 0. */
|
||||
int grpc_channel_args_is_census_enabled(const grpc_channel_args *a);
|
||||
|
||||
#endif /* __GRPC_INTERNAL_CHANNEL_CHANNEL_ARGS_H__ */
|
||||
#endif /* __GRPC_INTERNAL_CHANNEL_CHANNEL_ARGS_H__ */
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@
|
|||
|
||||
/* Given a size, round up to the next multiple of sizeof(void*) */
|
||||
#define ROUND_UP_TO_ALIGNMENT_SIZE(x) \
|
||||
(((x)+GPR_MAX_ALIGNMENT - 1) & ~(GPR_MAX_ALIGNMENT - 1))
|
||||
(((x) + GPR_MAX_ALIGNMENT - 1) & ~(GPR_MAX_ALIGNMENT - 1))
|
||||
|
||||
size_t grpc_channel_stack_size(const grpc_channel_filter **filters,
|
||||
size_t filter_count) {
|
||||
|
|
@ -190,14 +190,13 @@ void grpc_channel_next_op(grpc_channel_element *elem, grpc_channel_op *op) {
|
|||
|
||||
grpc_channel_stack *grpc_channel_stack_from_top_element(
|
||||
grpc_channel_element *elem) {
|
||||
return (grpc_channel_stack *)((char *)(elem) -
|
||||
ROUND_UP_TO_ALIGNMENT_SIZE(
|
||||
sizeof(grpc_channel_stack)));
|
||||
return (grpc_channel_stack *)((char *)(elem)-ROUND_UP_TO_ALIGNMENT_SIZE(
|
||||
sizeof(grpc_channel_stack)));
|
||||
}
|
||||
|
||||
grpc_call_stack *grpc_call_stack_from_top_element(grpc_call_element *elem) {
|
||||
return (grpc_call_stack *)((char *)(elem) - ROUND_UP_TO_ALIGNMENT_SIZE(
|
||||
sizeof(grpc_call_stack)));
|
||||
return (grpc_call_stack *)((char *)(elem)-ROUND_UP_TO_ALIGNMENT_SIZE(
|
||||
sizeof(grpc_call_stack)));
|
||||
}
|
||||
|
||||
static void do_nothing(void *user_data, grpc_op_error error) {}
|
||||
|
|
|
|||
|
|
@ -302,4 +302,4 @@ void grpc_call_element_send_cancel(grpc_call_element *cur_elem);
|
|||
} while (0)
|
||||
#endif
|
||||
|
||||
#endif /* __GRPC_INTERNAL_CHANNEL_CHANNEL_STACK_H__ */
|
||||
#endif /* __GRPC_INTERNAL_CHANNEL_CHANNEL_STACK_H__ */
|
||||
|
|
|
|||
|
|
@ -59,4 +59,4 @@ grpc_transport_setup_result grpc_client_channel_transport_setup_complete(
|
|||
grpc_channel_filter const **channel_filters, size_t num_channel_filters,
|
||||
grpc_mdctx *mdctx);
|
||||
|
||||
#endif /* __GRPC_INTERNAL_CHANNEL_CLIENT_CHANNEL_H__ */
|
||||
#endif /* __GRPC_INTERNAL_CHANNEL_CLIENT_CHANNEL_H__ */
|
||||
|
|
|
|||
|
|
@ -64,4 +64,4 @@ gpr_timespec grpc_client_setup_request_deadline(grpc_client_setup_request *r);
|
|||
|
||||
grpc_mdctx *grpc_client_setup_get_mdctx(grpc_client_setup_request *r);
|
||||
|
||||
#endif /* __GRPC_INTERNAL_CHANNEL_CLIENT_SETUP_H__ */
|
||||
#endif /* __GRPC_INTERNAL_CHANNEL_CLIENT_SETUP_H__ */
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ typedef struct {
|
|||
/* We perform a small hack to locate transport data alongside the connected
|
||||
channel data in call allocations, to allow everything to be pulled in minimal
|
||||
cache line requests */
|
||||
#define TRANSPORT_STREAM_FROM_CALL_DATA(calld) ((grpc_stream *)((calld)+1))
|
||||
#define TRANSPORT_STREAM_FROM_CALL_DATA(calld) ((grpc_stream *)((calld) + 1))
|
||||
#define CALL_DATA_FROM_TRANSPORT_STREAM(transport_stream) \
|
||||
(((call_data *)(transport_stream)) - 1)
|
||||
|
||||
|
|
@ -257,9 +257,9 @@ static void destroy_channel_elem(grpc_channel_element *elem) {
|
|||
}
|
||||
|
||||
const grpc_channel_filter grpc_connected_channel_filter = {
|
||||
call_op, channel_op,
|
||||
call_op, channel_op,
|
||||
|
||||
sizeof(call_data), init_call_elem, destroy_call_elem,
|
||||
sizeof(call_data), init_call_elem, destroy_call_elem,
|
||||
|
||||
sizeof(channel_data), init_channel_elem, destroy_channel_elem,
|
||||
|
||||
|
|
|
|||
|
|
@ -46,4 +46,4 @@ extern const grpc_channel_filter grpc_connected_channel_filter;
|
|||
grpc_transport_setup_result grpc_connected_channel_bind_transport(
|
||||
grpc_channel_stack *channel_stack, grpc_transport *transport);
|
||||
|
||||
#endif /* __GRPC_INTERNAL_CHANNEL_CONNECTED_CHANNEL_H__ */
|
||||
#endif /* __GRPC_INTERNAL_CHANNEL_CONNECTED_CHANNEL_H__ */
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ struct grpc_metadata_buffer_impl {
|
|||
size_t elem_cap;
|
||||
};
|
||||
|
||||
#define ELEMS(buffer) ((qelem *)((buffer)+1))
|
||||
#define ELEMS(buffer) ((qelem *)((buffer) + 1))
|
||||
|
||||
void grpc_metadata_buffer_init(grpc_metadata_buffer *buffer) {
|
||||
/* start buffer as NULL, indicating no elements */
|
||||
|
|
|
|||
|
|
@ -67,4 +67,4 @@ grpc_metadata *grpc_metadata_buffer_extract_elements(
|
|||
grpc_metadata_buffer *buffer);
|
||||
void grpc_metadata_buffer_cleanup_elements(void *elements, grpc_op_error error);
|
||||
|
||||
#endif /* __GRPC_INTERNAL_CHANNEL_METADATA_BUFFER_H__ */
|
||||
#endif /* __GRPC_INTERNAL_CHANNEL_METADATA_BUFFER_H__ */
|
||||
|
|
|
|||
|
|
@ -131,9 +131,9 @@ static void destroy_channel_elem(grpc_channel_element *elem) {
|
|||
}
|
||||
|
||||
const grpc_channel_filter grpc_no_op_filter = {
|
||||
call_op, channel_op,
|
||||
call_op, channel_op,
|
||||
|
||||
sizeof(call_data), init_call_elem, destroy_call_elem,
|
||||
sizeof(call_data), init_call_elem, destroy_call_elem,
|
||||
|
||||
sizeof(channel_data), init_channel_elem, destroy_channel_elem,
|
||||
|
||||
|
|
|
|||
|
|
@ -41,4 +41,4 @@
|
|||
customize for their own filters */
|
||||
extern const grpc_channel_filter grpc_no_op_filter;
|
||||
|
||||
#endif /* __GRPC_INTERNAL_CHANNEL_NOOP_FILTER_H__ */
|
||||
#endif /* __GRPC_INTERNAL_CHANNEL_NOOP_FILTER_H__ */
|
||||
|
|
|
|||
|
|
@ -46,4 +46,4 @@ typedef enum {
|
|||
const char *grpc_compression_algorithm_name(
|
||||
grpc_compression_algorithm algorithm);
|
||||
|
||||
#endif /* __GRPC_INTERNAL_COMPRESSION_ALGORITHM_H__ */
|
||||
#endif /* __GRPC_INTERNAL_COMPRESSION_ALGORITHM_H__ */
|
||||
|
|
|
|||
|
|
@ -49,4 +49,4 @@ int grpc_msg_compress(grpc_compression_algorithm algorithm,
|
|||
int grpc_msg_decompress(grpc_compression_algorithm algorithm,
|
||||
gpr_slice_buffer *input, gpr_slice_buffer *output);
|
||||
|
||||
#endif /* __GRPC_INTERNAL_COMPRESSION_MESSAGE_COMPRESS_H__ */
|
||||
#endif /* __GRPC_INTERNAL_COMPRESSION_MESSAGE_COMPRESS_H__ */
|
||||
|
|
|
|||
|
|
@ -42,4 +42,4 @@ gpr_slice grpc_httpcli_format_post_request(const grpc_httpcli_request *request,
|
|||
const char *body_bytes,
|
||||
size_t body_size);
|
||||
|
||||
#endif /* __GRPC_INTERNAL_HTTPCLI_FORMAT_REQUEST_H__ */
|
||||
#endif /* __GRPC_INTERNAL_HTTPCLI_FORMAT_REQUEST_H__ */
|
||||
|
|
|
|||
|
|
@ -115,4 +115,4 @@ typedef int (*grpc_httpcli_post_override)(const grpc_httpcli_request *request,
|
|||
void grpc_httpcli_set_override(grpc_httpcli_get_override get,
|
||||
grpc_httpcli_post_override post);
|
||||
|
||||
#endif /* __GRPC_INTERNAL_HTTPCLI_HTTPCLI_H__ */
|
||||
#endif /* __GRPC_INTERNAL_HTTPCLI_HTTPCLI_H__ */
|
||||
|
|
|
|||
|
|
@ -40,4 +40,4 @@ grpc_security_status grpc_httpcli_ssl_channel_security_context_create(
|
|||
const unsigned char *pem_root_certs, size_t pem_root_certs_size,
|
||||
const char *secure_peer_name, grpc_channel_security_context **ctx);
|
||||
|
||||
#endif /* __GRPC_INTERNAL_HTTPCLI_HTTPCLI_SECURITY_CONTEXT_H__ */
|
||||
#endif /* __GRPC_INTERNAL_HTTPCLI_HTTPCLI_SECURITY_CONTEXT_H__ */
|
||||
|
|
|
|||
|
|
@ -61,4 +61,4 @@ void grpc_httpcli_parser_destroy(grpc_httpcli_parser *parser);
|
|||
int grpc_httpcli_parser_parse(grpc_httpcli_parser *parser, gpr_slice slice);
|
||||
int grpc_httpcli_parser_eof(grpc_httpcli_parser *parser);
|
||||
|
||||
#endif /* __GRPC_INTERNAL_HTTPCLI_PARSER_H__ */
|
||||
#endif /* __GRPC_INTERNAL_HTTPCLI_PARSER_H__ */
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@
|
|||
#define __GRPC_INTERNAL_IOMGR_POLLSET_H_
|
||||
|
||||
#include <grpc/support/port_platform.h>
|
||||
#include <grpc/support/time.h>
|
||||
|
||||
/* A grpc_pollset is a set of file descriptors that a higher level item is
|
||||
interested in. For example:
|
||||
|
|
|
|||
|
|
@ -157,6 +157,5 @@ static void destroy_channel_elem(grpc_channel_element *elem) {
|
|||
}
|
||||
|
||||
const grpc_channel_filter grpc_client_auth_filter = {
|
||||
call_op, channel_op, sizeof(call_data),
|
||||
init_call_elem, destroy_call_elem, sizeof(channel_data),
|
||||
init_channel_elem, destroy_channel_elem, "auth"};
|
||||
call_op, channel_op, sizeof(call_data), init_call_elem, destroy_call_elem,
|
||||
sizeof(channel_data), init_channel_elem, destroy_channel_elem, "auth"};
|
||||
|
|
|
|||
|
|
@ -38,4 +38,4 @@
|
|||
|
||||
extern const grpc_channel_filter grpc_client_auth_filter;
|
||||
|
||||
#endif /* __GRPC_INTERNAL_SECURITY_AUTH_H__ */
|
||||
#endif /* __GRPC_INTERNAL_SECURITY_AUTH_H__ */
|
||||
|
|
|
|||
|
|
@ -143,4 +143,4 @@ struct grpc_server_credentials {
|
|||
const grpc_ssl_config *grpc_ssl_server_credentials_get_config(
|
||||
const grpc_server_credentials *ssl_creds);
|
||||
|
||||
#endif /* __GRPC_INTERNAL_SECURITY_CREDENTIALS_H__ */
|
||||
#endif /* __GRPC_INTERNAL_SECURITY_CREDENTIALS_H__ */
|
||||
|
|
|
|||
|
|
@ -37,4 +37,4 @@
|
|||
extern unsigned char grpc_google_root_certs[];
|
||||
extern unsigned int grpc_google_root_certs_size;
|
||||
|
||||
#endif /* __GRPC_INTERNAL_SECURITY_GOOGLE_ROOT_CERTS_H__ */
|
||||
#endif /* __GRPC_INTERNAL_SECURITY_GOOGLE_ROOT_CERTS_H__ */
|
||||
|
|
|
|||
|
|
@ -44,4 +44,4 @@ grpc_endpoint *grpc_secure_endpoint_create(
|
|||
struct tsi_frame_protector *protector, grpc_endpoint *to_wrap,
|
||||
gpr_slice *leftover_slices, size_t leftover_nslices);
|
||||
|
||||
#endif /* __GRPC_INTERNAL_ENDPOINT_SECURE_ENDPOINT_H__ */
|
||||
#endif /* __GRPC_INTERNAL_ENDPOINT_SECURE_ENDPOINT_H__ */
|
||||
|
|
|
|||
|
|
@ -50,4 +50,4 @@ void grpc_setup_secure_transport(grpc_security_context *ctx,
|
|||
grpc_secure_transport_setup_done_cb cb,
|
||||
void *user_data);
|
||||
|
||||
#endif /* __GRPC_INTERNAL_SECURITY_SECURE_TRANSPORT_SETUP_H__ */
|
||||
#endif /* __GRPC_INTERNAL_SECURITY_SECURE_TRANSPORT_SETUP_H__ */
|
||||
|
|
|
|||
|
|
@ -100,8 +100,7 @@ grpc_arg grpc_security_context_to_arg(grpc_security_context *ctx) {
|
|||
return result;
|
||||
}
|
||||
|
||||
grpc_security_context *grpc_security_context_from_arg(
|
||||
const grpc_arg *arg) {
|
||||
grpc_security_context *grpc_security_context_from_arg(const grpc_arg *arg) {
|
||||
if (strcmp(arg->key, GRPC_SECURITY_CONTEXT_ARG)) return NULL;
|
||||
if (arg->type != GRPC_ARG_POINTER) {
|
||||
gpr_log(GPR_ERROR, "Invalid type %d for arg %s", arg->type,
|
||||
|
|
@ -140,9 +139,7 @@ static void fake_channel_destroy(grpc_security_context *ctx) {
|
|||
gpr_free(ctx);
|
||||
}
|
||||
|
||||
static void fake_server_destroy(grpc_security_context *ctx) {
|
||||
gpr_free(ctx);
|
||||
}
|
||||
static void fake_server_destroy(grpc_security_context *ctx) { gpr_free(ctx); }
|
||||
|
||||
static grpc_security_status fake_channel_create_handshaker(
|
||||
grpc_security_context *ctx, tsi_handshaker **handshaker) {
|
||||
|
|
@ -234,8 +231,7 @@ static void ssl_channel_destroy(grpc_security_context *ctx) {
|
|||
}
|
||||
|
||||
static void ssl_server_destroy(grpc_security_context *ctx) {
|
||||
grpc_ssl_server_security_context *c =
|
||||
(grpc_ssl_server_security_context *)ctx;
|
||||
grpc_ssl_server_security_context *c = (grpc_ssl_server_security_context *)ctx;
|
||||
if (c->handshaker_factory != NULL) {
|
||||
tsi_ssl_handshaker_factory_destroy(c->handshaker_factory);
|
||||
}
|
||||
|
|
@ -267,8 +263,7 @@ static grpc_security_status ssl_channel_create_handshaker(
|
|||
|
||||
static grpc_security_status ssl_server_create_handshaker(
|
||||
grpc_security_context *ctx, tsi_handshaker **handshaker) {
|
||||
grpc_ssl_server_security_context *c =
|
||||
(grpc_ssl_server_security_context *)ctx;
|
||||
grpc_ssl_server_security_context *c = (grpc_ssl_server_security_context *)ctx;
|
||||
return ssl_create_handshaker(c->handshaker_factory, 0, NULL, handshaker);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ grpc_security_context *grpc_find_security_context_in_args(
|
|||
typedef struct grpc_channel_security_context grpc_channel_security_context;
|
||||
|
||||
struct grpc_channel_security_context {
|
||||
grpc_security_context base; /* requires is_client_side to be non 0. */
|
||||
grpc_security_context base; /* requires is_client_side to be non 0. */
|
||||
grpc_credentials *request_metadata_creds;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -70,8 +70,7 @@ static void on_accept(void *server, grpc_endpoint *tcp) {
|
|||
const grpc_channel_args *args = grpc_server_get_channel_args(server);
|
||||
grpc_security_context *ctx = grpc_find_security_context_in_args(args);
|
||||
GPR_ASSERT(ctx);
|
||||
grpc_setup_secure_transport(ctx, tcp, on_secure_transport_setup_done,
|
||||
server);
|
||||
grpc_setup_secure_transport(ctx, tcp, on_secure_transport_setup_done, server);
|
||||
}
|
||||
|
||||
/* Note: the following code is the same with server_chttp2.c */
|
||||
|
|
|
|||
|
|
@ -73,4 +73,4 @@ census_op_id census_tracing_start_op();
|
|||
/* Ends tracing. Calling this function will invalidate the input op_id. */
|
||||
void census_tracing_end_op(census_op_id op_id);
|
||||
|
||||
#endif /* __GRPC_INTERNAL_STATISTICS_CENSUS_INTERFACE_H__ */
|
||||
#endif /* __GRPC_INTERNAL_STATISTICS_CENSUS_INTERFACE_H__ */
|
||||
|
|
|
|||
|
|
@ -98,4 +98,4 @@ void census_stats_store_shutdown();
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif /* __GRPC_INTERNAL_STATISTICS_CENSUS_RPC_STATS_H__ */
|
||||
#endif /* __GRPC_INTERNAL_STATISTICS_CENSUS_RPC_STATS_H__ */
|
||||
|
|
|
|||
|
|
@ -62,6 +62,4 @@ void *gpr_malloc_aligned(size_t size, size_t alignment) {
|
|||
return (void *)ret;
|
||||
}
|
||||
|
||||
void gpr_free_aligned(void *ptr) {
|
||||
free(((void **)ptr)[-1]);
|
||||
}
|
||||
void gpr_free_aligned(void *ptr) { free(((void **)ptr)[-1]); }
|
||||
|
|
|
|||
|
|
@ -46,4 +46,4 @@ int gpr_cpu_num_cores();
|
|||
[0, gpr_cpu_num_cores() - 1] */
|
||||
int gpr_cpu_current_cpu();
|
||||
|
||||
#endif /* __GRPC_INTERNAL_SUPPORT_CPU_H__ */
|
||||
#endif /* __GRPC_INTERNAL_SUPPORT_CPU_H__ */
|
||||
|
|
|
|||
|
|
@ -41,4 +41,4 @@
|
|||
/* compute the hash of key (length len) */
|
||||
gpr_uint32 gpr_murmur_hash3(const void *key, size_t len, gpr_uint32 seed);
|
||||
|
||||
#endif /* __GRPC_INTERNAL_SUPPORT_MURMUR_HASH_H__ */
|
||||
#endif /* __GRPC_INTERNAL_SUPPORT_MURMUR_HASH_H__ */
|
||||
|
|
|
|||
|
|
@ -36,4 +36,4 @@
|
|||
|
||||
/* Internal interfaces between modules within the gpr support library. */
|
||||
|
||||
#endif /* __GRPC_INTERNAL_SUPPORT_THD_INTERNAL_H__ */
|
||||
#endif /* __GRPC_INTERNAL_SUPPORT_THD_INTERNAL_H__ */
|
||||
|
|
|
|||
|
|
@ -197,7 +197,7 @@ struct grpc_call {
|
|||
gpr_refcount internal_refcount;
|
||||
};
|
||||
|
||||
#define CALL_STACK_FROM_CALL(call) ((grpc_call_stack *)((call)+1))
|
||||
#define CALL_STACK_FROM_CALL(call) ((grpc_call_stack *)((call) + 1))
|
||||
#define CALL_FROM_CALL_STACK(call_stack) (((grpc_call *)(call_stack)) - 1)
|
||||
#define CALL_ELEM_FROM_CALL(call, idx) \
|
||||
grpc_call_stack_element(CALL_STACK_FROM_CALL(call), idx)
|
||||
|
|
|
|||
|
|
@ -73,4 +73,4 @@ grpc_metadata_buffer *grpc_call_get_metadata_buffer(grpc_call *call);
|
|||
void grpc_call_add_mdelem(grpc_call *call, grpc_mdelem *mdelem,
|
||||
gpr_uint32 flags);
|
||||
|
||||
#endif /* __GRPC_INTERNAL_SURFACE_CALL_H__ */
|
||||
#endif /* __GRPC_INTERNAL_SURFACE_CALL_H__ */
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ struct grpc_channel {
|
|||
grpc_mdstr *authority_string;
|
||||
};
|
||||
|
||||
#define CHANNEL_STACK_FROM_CHANNEL(c) ((grpc_channel_stack *)((c)+1))
|
||||
#define CHANNEL_STACK_FROM_CHANNEL(c) ((grpc_channel_stack *)((c) + 1))
|
||||
|
||||
grpc_channel *grpc_channel_create_from_filters(
|
||||
const grpc_channel_filter **filters, size_t num_filters,
|
||||
|
|
|
|||
|
|
@ -48,4 +48,4 @@ grpc_mdstr *grpc_channel_get_message_string(grpc_channel *channel);
|
|||
void grpc_channel_internal_ref(grpc_channel *channel);
|
||||
void grpc_channel_internal_unref(grpc_channel *channel);
|
||||
|
||||
#endif /* __GRPC_INTERNAL_SURFACE_CHANNEL_H__ */
|
||||
#endif /* __GRPC_INTERNAL_SURFACE_CHANNEL_H__ */
|
||||
|
|
|
|||
|
|
@ -106,13 +106,12 @@ static void init_channel_elem(grpc_channel_element *elem,
|
|||
GPR_ASSERT(!is_last);
|
||||
}
|
||||
|
||||
static void destroy_channel_elem(grpc_channel_element *elem) {
|
||||
}
|
||||
static void destroy_channel_elem(grpc_channel_element *elem) {}
|
||||
|
||||
const grpc_channel_filter grpc_client_surface_filter = {
|
||||
call_op, channel_op,
|
||||
call_op, channel_op,
|
||||
|
||||
sizeof(call_data), init_call_elem, destroy_call_elem,
|
||||
sizeof(call_data), init_call_elem, destroy_call_elem,
|
||||
|
||||
sizeof(channel_data), init_channel_elem, destroy_channel_elem,
|
||||
|
||||
|
|
|
|||
|
|
@ -38,4 +38,4 @@
|
|||
|
||||
extern const grpc_channel_filter grpc_client_surface_filter;
|
||||
|
||||
#endif /* __GRPC_INTERNAL_SURFACE_CLIENT_H__ */
|
||||
#endif /* __GRPC_INTERNAL_SURFACE_CLIENT_H__ */
|
||||
|
|
|
|||
|
|
@ -104,4 +104,4 @@ void grpc_cq_dump_pending_ops(grpc_completion_queue *cc);
|
|||
|
||||
grpc_pollset *grpc_cq_pollset(grpc_completion_queue *cc);
|
||||
|
||||
#endif /* __GRPC_INTERNAL_SURFACE_COMPLETION_QUEUE_H__ */
|
||||
#endif /* __GRPC_INTERNAL_SURFACE_COMPLETION_QUEUE_H__ */
|
||||
|
|
|
|||
|
|
@ -39,4 +39,4 @@
|
|||
/* Returns a string describing an event. Must be later freed with gpr_free() */
|
||||
char *grpc_event_string(grpc_event *ev);
|
||||
|
||||
#endif /* __GRPC_INTERNAL_SURFACE_EVENT_STRING_H__ */
|
||||
#endif /* __GRPC_INTERNAL_SURFACE_EVENT_STRING_H__ */
|
||||
|
|
|
|||
|
|
@ -405,9 +405,9 @@ static void destroy_channel_elem(grpc_channel_element *elem) {
|
|||
}
|
||||
|
||||
static const grpc_channel_filter server_surface_filter = {
|
||||
call_op, channel_op,
|
||||
call_op, channel_op,
|
||||
|
||||
sizeof(call_data), init_call_elem, destroy_call_elem,
|
||||
sizeof(call_data), init_call_elem, destroy_call_elem,
|
||||
|
||||
sizeof(channel_data), init_channel_elem, destroy_channel_elem,
|
||||
|
||||
|
|
|
|||
|
|
@ -60,4 +60,4 @@ grpc_transport_setup_result grpc_server_setup_transport(
|
|||
|
||||
const grpc_channel_args *grpc_server_get_channel_args(grpc_server *server);
|
||||
|
||||
#endif /* __GRPC_INTERNAL_SURFACE_SERVER_H__ */
|
||||
#endif /* __GRPC_INTERNAL_SURFACE_SERVER_H__ */
|
||||
|
|
|
|||
|
|
@ -51,4 +51,4 @@
|
|||
} while (0)
|
||||
#endif
|
||||
|
||||
#endif /* __GRPC_INTERNAL_SURFACE_SURFACE_TRACE_H__ */
|
||||
#endif /* __GRPC_INTERNAL_SURFACE_SURFACE_TRACE_H__ */
|
||||
|
|
|
|||
|
|
@ -77,4 +77,4 @@ typedef struct {
|
|||
#define GRPC_CHTTP2_DATA_FLAG_PADDED 8
|
||||
#define GRPC_CHTTP2_FLAG_HAS_PRIORITY 0x20
|
||||
|
||||
#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_FRAME_H__ */
|
||||
#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_FRAME_H__ */
|
||||
|
|
|
|||
|
|
@ -161,4 +161,3 @@ grpc_chttp2_parse_error grpc_chttp2_data_parser_parse(
|
|||
abort();
|
||||
return GRPC_CHTTP2_CONNECTION_ERROR;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -77,4 +77,4 @@ grpc_chttp2_parse_error grpc_chttp2_data_parser_parse(
|
|||
/* create a slice with an empty data frame and is_last set */
|
||||
gpr_slice grpc_chttp2_data_frame_create_empty_close(gpr_uint32 id);
|
||||
|
||||
#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_FRAME_DATA_H__ */
|
||||
#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_FRAME_DATA_H__ */
|
||||
|
|
|
|||
|
|
@ -50,4 +50,4 @@ grpc_chttp2_parse_error grpc_chttp2_ping_parser_begin_frame(
|
|||
grpc_chttp2_parse_error grpc_chttp2_ping_parser_parse(
|
||||
void *parser, grpc_chttp2_parse_state *state, gpr_slice slice, int is_last);
|
||||
|
||||
#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_FRAME_PING_H__ */
|
||||
#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_FRAME_PING_H__ */
|
||||
|
|
|
|||
|
|
@ -38,4 +38,4 @@
|
|||
|
||||
gpr_slice grpc_chttp2_rst_stream_create(gpr_uint32 stream_id, gpr_uint32 code);
|
||||
|
||||
#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_FRAME_RST_STREAM_H__ */
|
||||
#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_FRAME_RST_STREAM_H__ */
|
||||
|
|
|
|||
|
|
@ -96,4 +96,4 @@ grpc_chttp2_parse_error grpc_chttp2_settings_parser_begin_frame(
|
|||
grpc_chttp2_parse_error grpc_chttp2_settings_parser_parse(
|
||||
void *parser, grpc_chttp2_parse_state *state, gpr_slice slice, int is_last);
|
||||
|
||||
#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_FRAME_SETTINGS_H__ */
|
||||
#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_FRAME_SETTINGS_H__ */
|
||||
|
|
|
|||
|
|
@ -52,4 +52,4 @@ grpc_chttp2_parse_error grpc_chttp2_window_update_parser_begin_frame(
|
|||
grpc_chttp2_parse_error grpc_chttp2_window_update_parser_parse(
|
||||
void *parser, grpc_chttp2_parse_state *state, gpr_slice slice, int is_last);
|
||||
|
||||
#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_FRAME_WINDOW_UPDATE_H__ */
|
||||
#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_FRAME_WINDOW_UPDATE_H__ */
|
||||
|
|
|
|||
|
|
@ -108,4 +108,4 @@ grpc_chttp2_parse_error grpc_chttp2_header_parser_parse(
|
|||
void *hpack_parser, grpc_chttp2_parse_state *state, gpr_slice slice,
|
||||
int is_last);
|
||||
|
||||
#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_HPACK_PARSER_H__ */
|
||||
#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_HPACK_PARSER_H__ */
|
||||
|
|
|
|||
|
|
@ -43,68 +43,68 @@ static struct {
|
|||
const char *key;
|
||||
const char *value;
|
||||
} static_table[] = {
|
||||
/* 0: */ {NULL, NULL},
|
||||
/* 1: */ {":authority", ""},
|
||||
/* 2: */ {":method", "GET"},
|
||||
/* 3: */ {":method", "POST"},
|
||||
/* 4: */ {":path", "/"},
|
||||
/* 5: */ {":path", "/index.html"},
|
||||
/* 6: */ {":scheme", "http"},
|
||||
/* 7: */ {":scheme", "https"},
|
||||
/* 8: */ {":status", "200"},
|
||||
/* 9: */ {":status", "204"},
|
||||
/* 10: */ {":status", "206"},
|
||||
/* 11: */ {":status", "304"},
|
||||
/* 12: */ {":status", "400"},
|
||||
/* 13: */ {":status", "404"},
|
||||
/* 14: */ {":status", "500"},
|
||||
/* 15: */ {"accept-charset", ""},
|
||||
/* 16: */ {"accept-encoding", "gzip, deflate"},
|
||||
/* 17: */ {"accept-language", ""},
|
||||
/* 18: */ {"accept-ranges", ""},
|
||||
/* 19: */ {"accept", ""},
|
||||
/* 20: */ {"access-control-allow-origin", ""},
|
||||
/* 21: */ {"age", ""},
|
||||
/* 22: */ {"allow", ""},
|
||||
/* 23: */ {"authorization", ""},
|
||||
/* 24: */ {"cache-control", ""},
|
||||
/* 25: */ {"content-disposition", ""},
|
||||
/* 26: */ {"content-encoding", ""},
|
||||
/* 27: */ {"content-language", ""},
|
||||
/* 28: */ {"content-length", ""},
|
||||
/* 29: */ {"content-location", ""},
|
||||
/* 30: */ {"content-range", ""},
|
||||
/* 31: */ {"content-type", ""},
|
||||
/* 32: */ {"cookie", ""},
|
||||
/* 33: */ {"date", ""},
|
||||
/* 34: */ {"etag", ""},
|
||||
/* 35: */ {"expect", ""},
|
||||
/* 36: */ {"expires", ""},
|
||||
/* 37: */ {"from", ""},
|
||||
/* 38: */ {"host", ""},
|
||||
/* 39: */ {"if-match", ""},
|
||||
/* 40: */ {"if-modified-since", ""},
|
||||
/* 41: */ {"if-none-match", ""},
|
||||
/* 42: */ {"if-range", ""},
|
||||
/* 43: */ {"if-unmodified-since", ""},
|
||||
/* 44: */ {"last-modified", ""},
|
||||
/* 45: */ {"link", ""},
|
||||
/* 46: */ {"location", ""},
|
||||
/* 47: */ {"max-forwards", ""},
|
||||
/* 48: */ {"proxy-authenticate", ""},
|
||||
/* 49: */ {"proxy-authorization", ""},
|
||||
/* 50: */ {"range", ""},
|
||||
/* 51: */ {"referer", ""},
|
||||
/* 52: */ {"refresh", ""},
|
||||
/* 53: */ {"retry-after", ""},
|
||||
/* 54: */ {"server", ""},
|
||||
/* 55: */ {"set-cookie", ""},
|
||||
/* 56: */ {"strict-transport-security", ""},
|
||||
/* 57: */ {"transfer-encoding", ""},
|
||||
/* 58: */ {"user-agent", ""},
|
||||
/* 59: */ {"vary", ""},
|
||||
/* 60: */ {"via", ""},
|
||||
/* 61: */ {"www-authenticate", ""},
|
||||
/* 0: */ {NULL, NULL},
|
||||
/* 1: */ {":authority", ""},
|
||||
/* 2: */ {":method", "GET"},
|
||||
/* 3: */ {":method", "POST"},
|
||||
/* 4: */ {":path", "/"},
|
||||
/* 5: */ {":path", "/index.html"},
|
||||
/* 6: */ {":scheme", "http"},
|
||||
/* 7: */ {":scheme", "https"},
|
||||
/* 8: */ {":status", "200"},
|
||||
/* 9: */ {":status", "204"},
|
||||
/* 10: */ {":status", "206"},
|
||||
/* 11: */ {":status", "304"},
|
||||
/* 12: */ {":status", "400"},
|
||||
/* 13: */ {":status", "404"},
|
||||
/* 14: */ {":status", "500"},
|
||||
/* 15: */ {"accept-charset", ""},
|
||||
/* 16: */ {"accept-encoding", "gzip, deflate"},
|
||||
/* 17: */ {"accept-language", ""},
|
||||
/* 18: */ {"accept-ranges", ""},
|
||||
/* 19: */ {"accept", ""},
|
||||
/* 20: */ {"access-control-allow-origin", ""},
|
||||
/* 21: */ {"age", ""},
|
||||
/* 22: */ {"allow", ""},
|
||||
/* 23: */ {"authorization", ""},
|
||||
/* 24: */ {"cache-control", ""},
|
||||
/* 25: */ {"content-disposition", ""},
|
||||
/* 26: */ {"content-encoding", ""},
|
||||
/* 27: */ {"content-language", ""},
|
||||
/* 28: */ {"content-length", ""},
|
||||
/* 29: */ {"content-location", ""},
|
||||
/* 30: */ {"content-range", ""},
|
||||
/* 31: */ {"content-type", ""},
|
||||
/* 32: */ {"cookie", ""},
|
||||
/* 33: */ {"date", ""},
|
||||
/* 34: */ {"etag", ""},
|
||||
/* 35: */ {"expect", ""},
|
||||
/* 36: */ {"expires", ""},
|
||||
/* 37: */ {"from", ""},
|
||||
/* 38: */ {"host", ""},
|
||||
/* 39: */ {"if-match", ""},
|
||||
/* 40: */ {"if-modified-since", ""},
|
||||
/* 41: */ {"if-none-match", ""},
|
||||
/* 42: */ {"if-range", ""},
|
||||
/* 43: */ {"if-unmodified-since", ""},
|
||||
/* 44: */ {"last-modified", ""},
|
||||
/* 45: */ {"link", ""},
|
||||
/* 46: */ {"location", ""},
|
||||
/* 47: */ {"max-forwards", ""},
|
||||
/* 48: */ {"proxy-authenticate", ""},
|
||||
/* 49: */ {"proxy-authorization", ""},
|
||||
/* 50: */ {"range", ""},
|
||||
/* 51: */ {"referer", ""},
|
||||
/* 52: */ {"refresh", ""},
|
||||
/* 53: */ {"retry-after", ""},
|
||||
/* 54: */ {"server", ""},
|
||||
/* 55: */ {"set-cookie", ""},
|
||||
/* 56: */ {"strict-transport-security", ""},
|
||||
/* 57: */ {"transfer-encoding", ""},
|
||||
/* 58: */ {"user-agent", ""},
|
||||
/* 59: */ {"vary", ""},
|
||||
/* 60: */ {"via", ""},
|
||||
/* 61: */ {"www-authenticate", ""},
|
||||
};
|
||||
|
||||
void grpc_chttp2_hptbl_init(grpc_chttp2_hptbl *tbl, grpc_mdctx *mdctx) {
|
||||
|
|
|
|||
|
|
@ -94,4 +94,4 @@ typedef struct {
|
|||
grpc_chttp2_hptbl_find_result grpc_chttp2_hptbl_find(
|
||||
const grpc_chttp2_hptbl *tbl, grpc_mdelem *md);
|
||||
|
||||
#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_HPACK_TABLE_H__ */
|
||||
#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_HPACK_TABLE_H__ */
|
||||
|
|
|
|||
|
|
@ -53,4 +53,4 @@ typedef enum {
|
|||
GRPC_CHTTP2__ERROR_DO_NOT_USE = -1
|
||||
} grpc_chttp2_error_code;
|
||||
|
||||
#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_HTTP2_ERRORS_H__ */
|
||||
#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_HTTP2_ERRORS_H__ */
|
||||
|
|
|
|||
|
|
@ -47,4 +47,4 @@ grpc_status_code grpc_chttp2_http2_error_to_grpc_status(
|
|||
grpc_status_code grpc_chttp2_http2_status_to_grpc_status(int status);
|
||||
int grpc_chttp2_grpc_status_to_http2_status(grpc_status_code status);
|
||||
|
||||
#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_STATUS_CONVERSION_H__ */
|
||||
#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_STATUS_CONVERSION_H__ */
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue