|
|
|
@ -88,18 +88,18 @@ class ClientReader final : public ClientStreamingInterface, |
|
|
|
|
explicit ClientReader(ChannelInterface *channel, const RpcMethod &method, |
|
|
|
|
ClientContext *context, |
|
|
|
|
const google::protobuf::Message &request) |
|
|
|
|
: call_(channel->CreateCall(method, context, &cq_), channel) { |
|
|
|
|
: call_(channel->CreateCall(method, context, &cq_)) { |
|
|
|
|
CallOpBuffer buf; |
|
|
|
|
buf.AddSendMessage(request); |
|
|
|
|
buf.AddClientSendClose(); |
|
|
|
|
call_.PerformOps(buf, (void *)1); |
|
|
|
|
call_.PerformOps(&buf, (void *)1); |
|
|
|
|
cq_.Pluck((void *)1); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
virtual bool Read(R *msg) { |
|
|
|
|
CallOpBuffer buf; |
|
|
|
|
buf.AddRecvMessage(msg); |
|
|
|
|
call_.PerformOps(buf, (void *)2); |
|
|
|
|
call_.PerformOps(&buf, (void *)2); |
|
|
|
|
return cq_.Pluck((void *)2); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -107,7 +107,7 @@ class ClientReader final : public ClientStreamingInterface, |
|
|
|
|
CallOpBuffer buf; |
|
|
|
|
Status status; |
|
|
|
|
buf.AddClientRecvStatus(&status); |
|
|
|
|
call_.PerformOps(buf, (void *)3); |
|
|
|
|
call_.PerformOps(&buf, (void *)3); |
|
|
|
|
GPR_ASSERT(cq_.Pluck((void *)3)); |
|
|
|
|
return status; |
|
|
|
|
} |
|
|
|
@ -126,19 +126,19 @@ class ClientWriter final : public ClientStreamingInterface, |
|
|
|
|
ClientContext *context, |
|
|
|
|
google::protobuf::Message *response) |
|
|
|
|
: response_(response), |
|
|
|
|
call_(channel->CreateCall(method, context, &cq_), channel) {} |
|
|
|
|
call_(channel->CreateCall(method, context, &cq_)) {} |
|
|
|
|
|
|
|
|
|
virtual bool Write(const W& msg) { |
|
|
|
|
CallOpBuffer buf; |
|
|
|
|
buf.AddSendMessage(msg); |
|
|
|
|
call_.PerformOps(buf, (void *)2); |
|
|
|
|
call_.PerformOps(&buf, (void *)2); |
|
|
|
|
return cq_.Pluck((void *)2); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
virtual bool WritesDone() { |
|
|
|
|
CallOpBuffer buf; |
|
|
|
|
buf.AddClientSendClose(); |
|
|
|
|
call_.PerformOps(buf, (void *)3); |
|
|
|
|
call_.PerformOps(&buf, (void *)3); |
|
|
|
|
return cq_.Pluck((void *)3); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -147,7 +147,7 @@ class ClientWriter final : public ClientStreamingInterface, |
|
|
|
|
CallOpBuffer buf; |
|
|
|
|
Status status; |
|
|
|
|
buf.AddClientRecvStatus(&status); |
|
|
|
|
call_.PerformOps(buf, (void *)4); |
|
|
|
|
call_.PerformOps(&buf, (void *)4); |
|
|
|
|
GPR_ASSERT(cq_.Pluck((void *)4)); |
|
|
|
|
return status; |
|
|
|
|
} |
|
|
|
@ -167,26 +167,26 @@ class ClientReaderWriter final : public ClientStreamingInterface, |
|
|
|
|
// Blocking create a stream.
|
|
|
|
|
explicit ClientReaderWriter(ChannelInterface *channel, |
|
|
|
|
const RpcMethod &method, ClientContext *context) |
|
|
|
|
: call_(channel->CreateCall(method, context, &cq_), channel) {} |
|
|
|
|
: call_(channel->CreateCall(method, context, &cq_)) {} |
|
|
|
|
|
|
|
|
|
virtual bool Read(R *msg) { |
|
|
|
|
CallOpBuffer buf; |
|
|
|
|
buf.AddRecvMessage(msg); |
|
|
|
|
call_.PerformOps(buf, (void *)2); |
|
|
|
|
call_.PerformOps(&buf, (void *)2); |
|
|
|
|
return cq_.Pluck((void *)2); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
virtual bool Write(const W& msg) { |
|
|
|
|
CallOpBuffer buf; |
|
|
|
|
buf.AddSendMessage(msg); |
|
|
|
|
call_.PerformOps(buf, (void *)3); |
|
|
|
|
call_.PerformOps(&buf, (void *)3); |
|
|
|
|
return cq_.Pluck((void *)3); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
virtual bool WritesDone() { |
|
|
|
|
CallOpBuffer buf; |
|
|
|
|
buf.AddClientSendClose(); |
|
|
|
|
call_.PerformOps(buf, (void *)4); |
|
|
|
|
call_.PerformOps(&buf, (void *)4); |
|
|
|
|
return cq_.Pluck((void *)4); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -194,7 +194,7 @@ class ClientReaderWriter final : public ClientStreamingInterface, |
|
|
|
|
CallOpBuffer buf; |
|
|
|
|
Status status; |
|
|
|
|
buf.AddClientRecvStatus(&status); |
|
|
|
|
call_.PerformOps(buf, (void *)5); |
|
|
|
|
call_.PerformOps(&buf, (void *)5); |
|
|
|
|
GPR_ASSERT(cq_.Pluck((void *)5)); |
|
|
|
|
return status; |
|
|
|
|
} |
|
|
|
|