aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/grpc++/impl/codegen
diff options
context:
space:
mode:
authorGravatar Vijay Pai <vpai@google.com>2016-07-27 11:35:56 -0700
committerGravatar Vijay Pai <vpai@google.com>2016-07-27 11:35:56 -0700
commit2d04dd827ce66a54ea8ddc6c691f9c028833fd56 (patch)
tree6ca6e2c646e9691a07543a13c6d26ca49a970ccd /include/grpc++/impl/codegen
parent0a1c5989868cc7465b384139c137c6df3021f564 (diff)
Change API for next message size to allow a bool return value for failure
cases.
Diffstat (limited to 'include/grpc++/impl/codegen')
-rw-r--r--include/grpc++/impl/codegen/fc_unary.h5
-rw-r--r--include/grpc++/impl/codegen/sync_stream.h22
2 files changed, 21 insertions, 6 deletions
diff --git a/include/grpc++/impl/codegen/fc_unary.h b/include/grpc++/impl/codegen/fc_unary.h
index 22e40ab02e..768443912b 100644
--- a/include/grpc++/impl/codegen/fc_unary.h
+++ b/include/grpc++/impl/codegen/fc_unary.h
@@ -56,7 +56,10 @@ template <class RequestType, class ResponseType>
public:
FCUnary(Call* call, ServerContext* ctx): call_(call), ctx_(ctx), read_done_(false), write_done_(false) {}
~FCUnary() {}
- uint32_t NextMessageSize() {return call_->max_message_size();}
+ bool NextMessageSize(uint32_t *sz) {
+ *sz = call_->max_message_size();
+ return true;
+ }
bool Read(RequestType *request) {
if (read_done_) {
return false;
diff --git a/include/grpc++/impl/codegen/sync_stream.h b/include/grpc++/impl/codegen/sync_stream.h
index 0afa8b6aa4..930c72056c 100644
--- a/include/grpc++/impl/codegen/sync_stream.h
+++ b/include/grpc++/impl/codegen/sync_stream.h
@@ -71,7 +71,7 @@ class ReaderInterface {
virtual ~ReaderInterface() {}
/// Upper bound on the next message size available for reading on this stream
- virtual uint32_t NextMessageSize() = 0;
+ virtual bool NextMessageSize(uint32_t *sz) = 0;
/// Blocking read a message and parse to \a msg. Returns \a true on success.
/// This is thread-safe with respect to \a Write or \WritesDone methods on
@@ -151,7 +151,10 @@ class ClientReader GRPC_FINAL : public ClientReaderInterface<R> {
cq_.Pluck(&ops); /// status ignored
}
- uint32_t NextMessageSize() GRPC_OVERRIDE {return call_.max_message_size();}
+ bool NextMessageSize(uint32_t *sz) GRPC_OVERRIDE {
+ *sz = call_.max_message_size();
+ return true;
+ }
bool Read(R* msg) GRPC_OVERRIDE {
CallOpSet<CallOpRecvInitialMetadata, CallOpRecvMessage<R>> ops;
@@ -298,7 +301,10 @@ class ClientReaderWriter GRPC_FINAL : public ClientReaderWriterInterface<W, R> {
cq_.Pluck(&ops); // status ignored
}
- uint32_t NextMessageSize() GRPC_OVERRIDE {return call_.max_message_size();}
+ bool NextMessageSize(uint32_t *sz) GRPC_OVERRIDE {
+ *sz = call_.max_message_size();
+ return true;
+ }
bool Read(R* msg) GRPC_OVERRIDE {
CallOpSet<CallOpRecvInitialMetadata, CallOpRecvMessage<R>> ops;
@@ -359,7 +365,10 @@ class ServerReader GRPC_FINAL : public ReaderInterface<R> {
call_->cq()->Pluck(&ops);
}
- uint32_t NextMessageSize() GRPC_OVERRIDE {return call_->max_message_size();}
+ bool NextMessageSize(uint32_t *sz) GRPC_OVERRIDE {
+ *sz = call_->max_message_size();
+ return true;
+ }
bool Read(R* msg) GRPC_OVERRIDE {
CallOpSet<CallOpRecvMessage<R>> ops;
@@ -427,7 +436,10 @@ class ServerReaderWriter GRPC_FINAL : public WriterInterface<W>,
call_->cq()->Pluck(&ops);
}
- uint32_t NextMessageSize() GRPC_OVERRIDE {return call_->max_message_size();}
+ bool NextMessageSize(uint32_t *sz) GRPC_OVERRIDE {
+ *sz = call_->max_message_size();
+ return true;
+ }
bool Read(R* msg) GRPC_OVERRIDE {
CallOpSet<CallOpRecvMessage<R>> ops;