|
|
@ -303,14 +303,15 @@ class Server::SyncRequestThreadManager : public ThreadManager { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void AddSyncMethod(RpcServiceMethod* method, void* tag) { |
|
|
|
void AddSyncMethod(RpcServiceMethod* method, void* tag) { |
|
|
|
sync_requests_.emplace_back(method, tag); |
|
|
|
sync_requests_.emplace_back(new SyncRequest(method, tag)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void AddUnknownSyncMethod() { |
|
|
|
void AddUnknownSyncMethod() { |
|
|
|
if (!sync_requests_.empty()) { |
|
|
|
if (!sync_requests_.empty()) { |
|
|
|
unknown_method_.reset(new RpcServiceMethod( |
|
|
|
unknown_method_.reset(new RpcServiceMethod( |
|
|
|
"unknown", RpcMethod::BIDI_STREAMING, new UnknownMethodHandler)); |
|
|
|
"unknown", RpcMethod::BIDI_STREAMING, new UnknownMethodHandler)); |
|
|
|
sync_requests_.emplace_back(unknown_method_.get(), nullptr); |
|
|
|
sync_requests_.emplace_back( |
|
|
|
|
|
|
|
new SyncRequest(unknown_method_.get(), nullptr)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -328,8 +329,8 @@ class Server::SyncRequestThreadManager : public ThreadManager { |
|
|
|
void Start() { |
|
|
|
void Start() { |
|
|
|
if (!sync_requests_.empty()) { |
|
|
|
if (!sync_requests_.empty()) { |
|
|
|
for (auto m = sync_requests_.begin(); m != sync_requests_.end(); m++) { |
|
|
|
for (auto m = sync_requests_.begin(); m != sync_requests_.end(); m++) { |
|
|
|
m->SetupRequest(); |
|
|
|
(*m)->SetupRequest(); |
|
|
|
m->Request(server_->c_server(), server_cq_->cq()); |
|
|
|
(*m)->Request(server_->c_server(), server_cq_->cq()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Initialize(); // ThreadManager's Initialize()
|
|
|
|
Initialize(); // ThreadManager's Initialize()
|
|
|
@ -340,7 +341,7 @@ class Server::SyncRequestThreadManager : public ThreadManager { |
|
|
|
Server* server_; |
|
|
|
Server* server_; |
|
|
|
CompletionQueue* server_cq_; |
|
|
|
CompletionQueue* server_cq_; |
|
|
|
int cq_timeout_msec_; |
|
|
|
int cq_timeout_msec_; |
|
|
|
std::vector<SyncRequest> sync_requests_; |
|
|
|
std::vector<std::unique_ptr<SyncRequest>> sync_requests_; |
|
|
|
std::unique_ptr<RpcServiceMethod> unknown_method_; |
|
|
|
std::unique_ptr<RpcServiceMethod> unknown_method_; |
|
|
|
std::shared_ptr<Server::GlobalCallbacks> global_callbacks_; |
|
|
|
std::shared_ptr<Server::GlobalCallbacks> global_callbacks_; |
|
|
|
}; |
|
|
|
}; |
|
|
|