aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/grpc++
diff options
context:
space:
mode:
Diffstat (limited to 'include/grpc++')
-rw-r--r--include/grpc++/async_unary_call.h4
-rw-r--r--include/grpc++/auth_context.h34
-rw-r--r--include/grpc++/auth_property_iterator.h77
-rw-r--r--include/grpc++/byte_buffer.h4
-rw-r--r--include/grpc++/client_context.h8
-rw-r--r--include/grpc++/completion_queue.h2
-rw-r--r--include/grpc++/dynamic_thread_pool.h9
-rw-r--r--include/grpc++/generic_stub.h4
-rw-r--r--include/grpc++/impl/README.md4
-rw-r--r--include/grpc++/impl/call.h32
-rw-r--r--include/grpc++/impl/grpc_library.h1
-rw-r--r--include/grpc++/impl/rpc_service_method.h15
-rw-r--r--include/grpc++/impl/serialization_traits.h6
-rw-r--r--include/grpc++/impl/sync_no_cxx11.h8
-rw-r--r--include/grpc++/impl/thd_no_cxx11.h21
-rw-r--r--include/grpc++/server.h18
-rw-r--r--include/grpc++/server_builder.h12
-rw-r--r--include/grpc++/server_context.h2
-rw-r--r--include/grpc++/stream.h9
19 files changed, 128 insertions, 142 deletions
diff --git a/include/grpc++/async_unary_call.h b/include/grpc++/async_unary_call.h
index d631ccd134..3d22df4b33 100644
--- a/include/grpc++/async_unary_call.h
+++ b/include/grpc++/async_unary_call.h
@@ -121,8 +121,8 @@ class ServerAsyncResponseWriter GRPC_FINAL
}
// The response is dropped if the status is not OK.
if (status.ok()) {
- finish_buf_.ServerSendStatus(
- ctx_->trailing_metadata_, finish_buf_.SendMessage(msg));
+ finish_buf_.ServerSendStatus(ctx_->trailing_metadata_,
+ finish_buf_.SendMessage(msg));
} else {
finish_buf_.ServerSendStatus(ctx_->trailing_metadata_, status);
}
diff --git a/include/grpc++/auth_context.h b/include/grpc++/auth_context.h
index c42105b927..7dced90ce5 100644
--- a/include/grpc++/auth_context.h
+++ b/include/grpc++/auth_context.h
@@ -34,12 +34,43 @@
#ifndef GRPCXX_AUTH_CONTEXT_H
#define GRPCXX_AUTH_CONTEXT_H
+#include <iterator>
#include <vector>
-#include <grpc++/auth_property_iterator.h>
#include <grpc++/config.h>
+struct grpc_auth_context;
+struct grpc_auth_property;
+struct grpc_auth_property_iterator;
+
namespace grpc {
+class SecureAuthContext;
+
+typedef std::pair<grpc::string, grpc::string> AuthProperty;
+
+class AuthPropertyIterator
+ : public std::iterator<std::input_iterator_tag, const AuthProperty> {
+ public:
+ ~AuthPropertyIterator();
+ AuthPropertyIterator& operator++();
+ AuthPropertyIterator operator++(int);
+ bool operator==(const AuthPropertyIterator& rhs) const;
+ bool operator!=(const AuthPropertyIterator& rhs) const;
+ const AuthProperty operator*();
+
+ protected:
+ AuthPropertyIterator();
+ AuthPropertyIterator(const grpc_auth_property* property,
+ const grpc_auth_property_iterator* iter);
+
+ private:
+ friend class SecureAuthContext;
+ const grpc_auth_property* property_;
+ // The following items form a grpc_auth_property_iterator.
+ const grpc_auth_context* ctx_;
+ size_t index_;
+ const char* name_;
+};
class AuthContext {
public:
@@ -62,4 +93,3 @@ class AuthContext {
} // namespace grpc
#endif // GRPCXX_AUTH_CONTEXT_H
-
diff --git a/include/grpc++/auth_property_iterator.h b/include/grpc++/auth_property_iterator.h
deleted file mode 100644
index c7870c46be..0000000000
--- a/include/grpc++/auth_property_iterator.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- *
- * Copyright 2015, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#ifndef GRPCXX_AUTH_PROPERTY_ITERATOR_H
-#define GRPCXX_AUTH_PROPERTY_ITERATOR_H
-
-#include <iterator>
-#include <vector>
-
-#include <grpc++/config.h>
-
-struct grpc_auth_context;
-struct grpc_auth_property;
-struct grpc_auth_property_iterator;
-
-namespace grpc {
-class SecureAuthContext;
-
-typedef std::pair<grpc::string, grpc::string> AuthProperty;
-
-class AuthPropertyIterator
- : public std::iterator<std::input_iterator_tag, const AuthProperty> {
- public:
- ~AuthPropertyIterator();
- AuthPropertyIterator& operator++();
- AuthPropertyIterator operator++(int);
- bool operator==(const AuthPropertyIterator& rhs) const;
- bool operator!=(const AuthPropertyIterator& rhs) const;
- const AuthProperty operator*();
-
- protected:
- AuthPropertyIterator();
- AuthPropertyIterator(const grpc_auth_property* property,
- const grpc_auth_property_iterator* iter);
- private:
- friend class SecureAuthContext;
- const grpc_auth_property* property_;
- // The following items form a grpc_auth_property_iterator.
- const grpc_auth_context* ctx_;
- size_t index_;
- const char* name_;
-};
-
-} // namespace grpc
-
- #endif // GRPCXX_AUTH_PROPERTY_ITERATOR_H
-
diff --git a/include/grpc++/byte_buffer.h b/include/grpc++/byte_buffer.h
index cb3c6a1159..6467776398 100644
--- a/include/grpc++/byte_buffer.h
+++ b/include/grpc++/byte_buffer.h
@@ -91,8 +91,8 @@ class SerializationTraits<ByteBuffer, void> {
dest->set_buffer(byte_buffer);
return Status::OK;
}
- static Status Serialize(const ByteBuffer& source, grpc_byte_buffer** buffer,
- bool* own_buffer) {
+ static Status Serialize(const ByteBuffer& source, grpc_byte_buffer** buffer,
+ bool* own_buffer) {
*buffer = source.buffer();
*own_buffer = false;
return Status::OK;
diff --git a/include/grpc++/client_context.h b/include/grpc++/client_context.h
index 5137bf6a1a..8de2ba4877 100644
--- a/include/grpc++/client_context.h
+++ b/include/grpc++/client_context.h
@@ -185,7 +185,9 @@ class ClientContext {
// Get and set census context
void set_census_context(struct census_context* ccp) { census_context_ = ccp; }
- struct census_context* census_context() const { return census_context_; }
+ struct census_context* census_context() const {
+ return census_context_;
+ }
void TryCancel();
@@ -223,15 +225,11 @@ class ClientContext {
void set_call(grpc_call* call,
const std::shared_ptr<ChannelInterface>& channel);
- grpc_completion_queue* cq() { return cq_; }
- void set_cq(grpc_completion_queue* cq) { cq_ = cq; }
-
grpc::string authority() { return authority_; }
bool initial_metadata_received_;
std::shared_ptr<ChannelInterface> channel_;
grpc_call* call_;
- grpc_completion_queue* cq_;
gpr_timespec deadline_;
grpc::string authority_;
std::shared_ptr<Credentials> creds_;
diff --git a/include/grpc++/completion_queue.h b/include/grpc++/completion_queue.h
index 0523ab6a0e..2f30211145 100644
--- a/include/grpc++/completion_queue.h
+++ b/include/grpc++/completion_queue.h
@@ -63,6 +63,7 @@ template <class ServiceType, class RequestType, class ResponseType>
class ServerStreamingHandler;
template <class ServiceType, class RequestType, class ResponseType>
class BidiStreamingHandler;
+class UnknownMethodHandler;
class ChannelInterface;
class ClientContext;
@@ -138,6 +139,7 @@ class CompletionQueue : public GrpcLibrary {
friend class ServerStreamingHandler;
template <class ServiceType, class RequestType, class ResponseType>
friend class BidiStreamingHandler;
+ friend class UnknownMethodHandler;
friend class ::grpc::Server;
friend class ::grpc::ServerContext;
template <class InputMessage, class OutputMessage>
diff --git a/include/grpc++/dynamic_thread_pool.h b/include/grpc++/dynamic_thread_pool.h
index f0cd35940f..a4d4885b51 100644
--- a/include/grpc++/dynamic_thread_pool.h
+++ b/include/grpc++/dynamic_thread_pool.h
@@ -55,11 +55,12 @@ class DynamicThreadPool GRPC_FINAL : public ThreadPoolInterface {
private:
class DynamicThread {
- public:
- DynamicThread(DynamicThreadPool *pool);
+ public:
+ DynamicThread(DynamicThreadPool* pool);
~DynamicThread();
- private:
- DynamicThreadPool *pool_;
+
+ private:
+ DynamicThreadPool* pool_;
std::unique_ptr<grpc::thread> thd_;
void ThreadFunc();
};
diff --git a/include/grpc++/generic_stub.h b/include/grpc++/generic_stub.h
index c34e1fcf55..172f10e45a 100644
--- a/include/grpc++/generic_stub.h
+++ b/include/grpc++/generic_stub.h
@@ -52,8 +52,8 @@ class GenericStub GRPC_FINAL {
// begin a call to a named method
std::unique_ptr<GenericClientAsyncReaderWriter> Call(
- ClientContext* context, const grpc::string& method,
- CompletionQueue* cq, void* tag);
+ ClientContext* context, const grpc::string& method, CompletionQueue* cq,
+ void* tag);
private:
std::shared_ptr<ChannelInterface> channel_;
diff --git a/include/grpc++/impl/README.md b/include/grpc++/impl/README.md
new file mode 100644
index 0000000000..612150caa0
--- /dev/null
+++ b/include/grpc++/impl/README.md
@@ -0,0 +1,4 @@
+**The APIs in this directory are not stable!**
+
+This directory contains header files that need to be installed but are not part
+of the public API. Users should not use these headers directly.
diff --git a/include/grpc++/impl/call.h b/include/grpc++/impl/call.h
index 1fa4490779..bc1db4c12c 100644
--- a/include/grpc++/impl/call.h
+++ b/include/grpc++/impl/call.h
@@ -67,14 +67,10 @@ class WriteOptions {
WriteOptions(const WriteOptions& other) : flags_(other.flags_) {}
/// Clear all flags.
- inline void Clear() {
- flags_ = 0;
- }
+ inline void Clear() { flags_ = 0; }
/// Returns raw flags bitset.
- inline gpr_uint32 flags() const {
- return flags_;
- }
+ inline gpr_uint32 flags() const { return flags_; }
/// Sets flag for the disabling of compression for the next message write.
///
@@ -122,9 +118,7 @@ class WriteOptions {
/// not go out on the wire immediately.
///
/// \sa GRPC_WRITE_BUFFER_HINT
- inline bool get_buffer_hint() const {
- return GetBit(GRPC_WRITE_BUFFER_HINT);
- }
+ inline bool get_buffer_hint() const { return GetBit(GRPC_WRITE_BUFFER_HINT); }
WriteOptions& operator=(const WriteOptions& rhs) {
flags_ = rhs.flags_;
@@ -132,17 +126,11 @@ class WriteOptions {
}
private:
- void SetBit(const gpr_int32 mask) {
- flags_ |= mask;
- }
+ void SetBit(const gpr_int32 mask) { flags_ |= mask; }
- void ClearBit(const gpr_int32 mask) {
- flags_ &= ~mask;
- }
+ void ClearBit(const gpr_int32 mask) { flags_ &= ~mask; }
- bool GetBit(const gpr_int32 mask) const {
- return flags_ & mask;
- }
+ bool GetBit(const gpr_int32 mask) const { return flags_ & mask; }
gpr_uint32 flags_;
};
@@ -173,6 +161,7 @@ class CallOpSendInitialMetadata {
grpc_op* op = &ops[(*nops)++];
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->flags = 0;
+ op->reserved = NULL;
op->data.send_initial_metadata.count = initial_metadata_count_;
op->data.send_initial_metadata.metadata = initial_metadata_;
}
@@ -206,6 +195,7 @@ class CallOpSendMessage {
grpc_op* op = &ops[(*nops)++];
op->op = GRPC_OP_SEND_MESSAGE;
op->flags = write_options_.flags();
+ op->reserved = NULL;
op->data.send_message = send_buf_;
// Flags are per-message: clear them after use.
write_options_.Clear();
@@ -248,6 +238,7 @@ class CallOpRecvMessage {
grpc_op* op = &ops[(*nops)++];
op->op = GRPC_OP_RECV_MESSAGE;
op->flags = 0;
+ op->reserved = NULL;
op->data.recv_message = &recv_buf_;
}
@@ -313,6 +304,7 @@ class CallOpGenericRecvMessage {
grpc_op* op = &ops[(*nops)++];
op->op = GRPC_OP_RECV_MESSAGE;
op->flags = 0;
+ op->reserved = NULL;
op->data.recv_message = &recv_buf_;
}
@@ -350,6 +342,7 @@ class CallOpClientSendClose {
grpc_op* op = &ops[(*nops)++];
op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT;
op->flags = 0;
+ op->reserved = NULL;
}
void FinishOp(bool* status, int max_message_size) { send_ = false; }
@@ -383,6 +376,7 @@ class CallOpServerSendStatus {
op->data.send_status_from_server.status_details =
send_status_details_.empty() ? nullptr : send_status_details_.c_str();
op->flags = 0;
+ op->reserved = NULL;
}
void FinishOp(bool* status, int max_message_size) {
@@ -416,6 +410,7 @@ class CallOpRecvInitialMetadata {
op->op = GRPC_OP_RECV_INITIAL_METADATA;
op->data.recv_initial_metadata = &recv_initial_metadata_arr_;
op->flags = 0;
+ op->reserved = NULL;
}
void FinishOp(bool* status, int max_message_size) {
if (recv_initial_metadata_ == nullptr) return;
@@ -453,6 +448,7 @@ class CallOpClientRecvStatus {
op->data.recv_status_on_client.status_details_capacity =
&status_details_capacity_;
op->flags = 0;
+ op->reserved = NULL;
}
void FinishOp(bool* status, int max_message_size) {
diff --git a/include/grpc++/impl/grpc_library.h b/include/grpc++/impl/grpc_library.h
index f9fa677901..ce4211418d 100644
--- a/include/grpc++/impl/grpc_library.h
+++ b/include/grpc++/impl/grpc_library.h
@@ -46,5 +46,4 @@ class GrpcLibrary {
} // namespace grpc
-
#endif // GRPCXX_IMPL_GRPC_LIBRARY_H
diff --git a/include/grpc++/impl/rpc_service_method.h b/include/grpc++/impl/rpc_service_method.h
index 3cfbef7806..925801e1ce 100644
--- a/include/grpc++/impl/rpc_service_method.h
+++ b/include/grpc++/impl/rpc_service_method.h
@@ -208,6 +208,21 @@ class BidiStreamingHandler : public MethodHandler {
ServiceType* service_;
};
+// Handle unknown method by returning UNIMPLEMENTED error.
+class UnknownMethodHandler : public MethodHandler {
+ public:
+ void RunHandler(const HandlerParameter& param) GRPC_FINAL {
+ Status status(StatusCode::UNIMPLEMENTED, "");
+ CallOpSet<CallOpSendInitialMetadata, CallOpServerSendStatus> ops;
+ if (!param.server_context->sent_initial_metadata_) {
+ ops.SendInitialMetadata(param.server_context->initial_metadata_);
+ }
+ ops.ServerSendStatus(param.server_context->trailing_metadata_, status);
+ param.call->PerformOps(&ops);
+ param.call->cq()->Pluck(&ops);
+ }
+};
+
// Server side rpc method class
class RpcServiceMethod : public RpcMethod {
public:
diff --git a/include/grpc++/impl/serialization_traits.h b/include/grpc++/impl/serialization_traits.h
index 1f5c674e4c..3ea66a3405 100644
--- a/include/grpc++/impl/serialization_traits.h
+++ b/include/grpc++/impl/serialization_traits.h
@@ -37,12 +37,12 @@
namespace grpc {
/// Defines how to serialize and deserialize some type.
-///
+///
/// Used for hooking different message serialization API's into GRPC.
/// Each SerializationTraits implementation must provide the following
/// functions:
/// static Status Serialize(const Message& msg,
-/// grpc_byte_buffer** buffer,
+/// grpc_byte_buffer** buffer,
// bool* own_buffer);
/// static Status Deserialize(grpc_byte_buffer* buffer,
/// Message* msg,
@@ -57,7 +57,7 @@ namespace grpc {
/// msg. max_message_size is passed in as a bound on the maximum number of
/// message bytes Deserialize should accept.
///
-/// Both functions return a Status, allowing them to explain what went
+/// Both functions return a Status, allowing them to explain what went
/// wrong if required.
template <class Message,
class UnusedButHereForPartialTemplateSpecialization = void>
diff --git a/include/grpc++/impl/sync_no_cxx11.h b/include/grpc++/impl/sync_no_cxx11.h
index 5869b04c76..120a031045 100644
--- a/include/grpc++/impl/sync_no_cxx11.h
+++ b/include/grpc++/impl/sync_no_cxx11.h
@@ -38,7 +38,7 @@
namespace grpc {
-template<class mutex>
+template <class mutex>
class lock_guard;
class condition_variable;
@@ -46,6 +46,7 @@ class mutex {
public:
mutex() { gpr_mu_init(&mu_); }
~mutex() { gpr_mu_destroy(&mu_); }
+
private:
::gpr_mu mu_;
template <class mutex>
@@ -58,6 +59,7 @@ class lock_guard {
public:
lock_guard(mutex &mu) : mu_(mu), locked(true) { gpr_mu_lock(&mu.mu_); }
~lock_guard() { unlock_internal(); }
+
protected:
void lock_internal() {
if (!locked) gpr_mu_lock(&mu_.mu_);
@@ -67,6 +69,7 @@ class lock_guard {
if (locked) gpr_mu_unlock(&mu_.mu_);
locked = false;
}
+
private:
mutex &mu_;
bool locked;
@@ -76,7 +79,7 @@ class lock_guard {
template <class mutex>
class unique_lock : public lock_guard<mutex> {
public:
- unique_lock(mutex &mu) : lock_guard<mutex>(mu) { }
+ unique_lock(mutex &mu) : lock_guard<mutex>(mu) {}
void lock() { this->lock_internal(); }
void unlock() { this->unlock_internal(); }
};
@@ -92,6 +95,7 @@ class condition_variable {
}
void notify_one() { gpr_cv_signal(&cv_); }
void notify_all() { gpr_cv_broadcast(&cv_); }
+
private:
gpr_cv cv_;
};
diff --git a/include/grpc++/impl/thd_no_cxx11.h b/include/grpc++/impl/thd_no_cxx11.h
index a6bdd7dfe9..84d03ce184 100644
--- a/include/grpc++/impl/thd_no_cxx11.h
+++ b/include/grpc++/impl/thd_no_cxx11.h
@@ -40,7 +40,8 @@ namespace grpc {
class thread {
public:
- template<class T> thread(void (T::*fptr)(), T *obj) {
+ template <class T>
+ thread(void (T::*fptr)(), T *obj) {
func_ = new thread_function<T>(fptr, obj);
joined_ = false;
start();
@@ -53,28 +54,28 @@ class thread {
gpr_thd_join(thd_);
joined_ = true;
}
+
private:
void start() {
gpr_thd_options options = gpr_thd_options_default();
gpr_thd_options_set_joinable(&options);
- gpr_thd_new(&thd_, thread_func, (void *) func_, &options);
+ gpr_thd_new(&thd_, thread_func, (void *)func_, &options);
}
static void thread_func(void *arg) {
- thread_function_base *func = (thread_function_base *) arg;
+ thread_function_base *func = (thread_function_base *)arg;
func->call();
}
class thread_function_base {
public:
- virtual ~thread_function_base() { }
+ virtual ~thread_function_base() {}
virtual void call() = 0;
};
- template<class T>
+ template <class T>
class thread_function : public thread_function_base {
public:
- thread_function(void (T::*fptr)(), T *obj)
- : fptr_(fptr)
- , obj_(obj) { }
+ thread_function(void (T::*fptr)(), T *obj) : fptr_(fptr), obj_(obj) {}
virtual void call() { (obj_->*fptr_)(); }
+
private:
void (T::*fptr_)();
T *obj_;
@@ -84,8 +85,8 @@ class thread {
bool joined_;
// Disallow copy and assign.
- thread(const thread&);
- void operator=(const thread&);
+ thread(const thread &);
+ void operator=(const thread &);
};
} // namespace grpc
diff --git a/include/grpc++/server.h b/include/grpc++/server.h
index 07dbd7fd20..3e8b6a976a 100644
--- a/include/grpc++/server.h
+++ b/include/grpc++/server.h
@@ -64,7 +64,14 @@ class Server GRPC_FINAL : public GrpcLibrary, private CallHook {
~Server();
// Shutdown the server, block until all rpc processing finishes.
- void Shutdown();
+ // Forcefully terminate pending calls after deadline expires.
+ template <class T>
+ void Shutdown(const T& deadline) {
+ ShutdownInternal(TimePoint<T>(deadline).raw_time());
+ }
+
+ // Shutdown the server, waiting for all rpc processing to finish.
+ void Shutdown() { ShutdownInternal(gpr_inf_future(GPR_CLOCK_MONOTONIC)); }
// Block waiting for all work to complete (the server must either
// be shutting down or some other thread must call Shutdown for this
@@ -85,8 +92,9 @@ class Server GRPC_FINAL : public GrpcLibrary, private CallHook {
int max_message_size, grpc_compression_options compression_options);
// Register a service. This call does not take ownership of the service.
// The service must exist for the lifetime of the Server instance.
- bool RegisterService(const grpc::string *host, RpcService* service);
- bool RegisterAsyncService(const grpc::string *host, AsynchronousService* service);
+ bool RegisterService(const grpc::string* host, RpcService* service);
+ bool RegisterAsyncService(const grpc::string* host,
+ AsynchronousService* service);
void RegisterAsyncGenericService(AsyncGenericService* service);
// Add a listening port. Can be called multiple times.
int AddListeningPort(const grpc::string& addr, ServerCredentials* creds);
@@ -99,6 +107,8 @@ class Server GRPC_FINAL : public GrpcLibrary, private CallHook {
void PerformOpsOnCall(CallOpSetInterface* ops, Call* call) GRPC_OVERRIDE;
+ void ShutdownInternal(gpr_timespec deadline);
+
class BaseAsyncRequest : public CompletionQueueTag {
public:
BaseAsyncRequest(Server* server, ServerContext* context,
@@ -229,6 +239,8 @@ class Server GRPC_FINAL : public GrpcLibrary, private CallHook {
grpc::condition_variable callback_cv_;
std::list<SyncRequest>* sync_methods_;
+ std::unique_ptr<RpcServiceMethod> unknown_method_;
+ bool has_generic_service_;
// Pointer to the c grpc server.
grpc_server* const server_;
diff --git a/include/grpc++/server_builder.h b/include/grpc++/server_builder.h
index 47efbb7834..f1a713a487 100644
--- a/include/grpc++/server_builder.h
+++ b/include/grpc++/server_builder.h
@@ -78,7 +78,7 @@ class ServerBuilder {
// BuildAndStart().
// Only matches requests with :authority \a host
ServerBuilder& RegisterService(const grpc::string& host,
- SynchronousService* service);
+ SynchronousService* service);
// Register an asynchronous service.
// This call does not take ownership of the service or completion queue.
@@ -86,7 +86,7 @@ class ServerBuilder {
// instance returned by BuildAndStart().
// Only matches requests with :authority \a host
ServerBuilder& RegisterAsyncService(const grpc::string& host,
- AsynchronousService* service);
+ AsynchronousService* service);
// Set max message size in bytes.
ServerBuilder& SetMaxMessageSize(int max_message_size);
@@ -119,9 +119,10 @@ class ServerBuilder {
};
typedef std::unique_ptr<grpc::string> HostString;
- template <class T> struct NamedService {
+ template <class T>
+ struct NamedService {
explicit NamedService(T* s) : service(s) {}
- NamedService(const grpc::string& h, T *s)
+ NamedService(const grpc::string& h, T* s)
: host(new grpc::string(h)), service(s) {}
HostString host;
T* service;
@@ -130,7 +131,8 @@ class ServerBuilder {
int max_message_size_;
grpc_compression_options compression_options_;
std::vector<std::unique_ptr<NamedService<RpcService>>> services_;
- std::vector<std::unique_ptr<NamedService<AsynchronousService>>> async_services_;
+ std::vector<std::unique_ptr<NamedService<AsynchronousService>>>
+ async_services_;
std::vector<Port> ports_;
std::vector<ServerCompletionQueue*> cqs_;
std::shared_ptr<ServerCredentials> creds_;
diff --git a/include/grpc++/server_context.h b/include/grpc++/server_context.h
index 2296835461..b87a1f0379 100644
--- a/include/grpc++/server_context.h
+++ b/include/grpc++/server_context.h
@@ -73,6 +73,7 @@ template <class ServiceType, class RequestType, class ResponseType>
class ServerStreamingHandler;
template <class ServiceType, class RequestType, class ResponseType>
class BidiStreamingHandler;
+class UnknownMethodHandler;
class Call;
class CallOpBuffer;
@@ -159,6 +160,7 @@ class ServerContext {
friend class ServerStreamingHandler;
template <class ServiceType, class RequestType, class ResponseType>
friend class BidiStreamingHandler;
+ friend class UnknownMethodHandler;
friend class ::grpc::ClientContext;
// Prevent copying.
diff --git a/include/grpc++/stream.h b/include/grpc++/stream.h
index bc0c3c0f3b..45dafcd282 100644
--- a/include/grpc++/stream.h
+++ b/include/grpc++/stream.h
@@ -85,9 +85,7 @@ class WriterInterface {
// Returns false when the stream has been closed.
virtual bool Write(const W& msg, const WriteOptions& options) = 0;
- inline bool Write(const W& msg) {
- return Write(msg, WriteOptions());
- }
+ inline bool Write(const W& msg) { return Write(msg, WriteOptions()); }
};
template <class R>
@@ -640,9 +638,8 @@ class ServerAsyncReader GRPC_FINAL : public ServerAsyncStreamingInterface,
}
// The response is dropped if the status is not OK.
if (status.ok()) {
- finish_ops_.ServerSendStatus(
- ctx_->trailing_metadata_,
- finish_ops_.SendMessage(msg));
+ finish_ops_.ServerSendStatus(ctx_->trailing_metadata_,
+ finish_ops_.SendMessage(msg));
} else {
finish_ops_.ServerSendStatus(ctx_->trailing_metadata_, status);
}