chenBright commented on code in PR #2493:
URL: https://github.com/apache/brpc/pull/2493#discussion_r1446061274
##########
src/brpc/server.cpp:
##########
@@ -565,13 +565,22 @@ int Server::AddBuiltinServices() {
LOG(ERROR) << "Fail to add GetJsService";
return -1;
}
- if (AddBuiltinService(new (std::nothrow) GrpcHealthCheckService)) {
+ if (ProtocolEnabled("h2") &&
+ AddBuiltinService(new (std::nothrow) GrpcHealthCheckService)) {
LOG(ERROR) << "Fail to add GrpcHealthCheckService";
return -1;
}
return 0;
}
+bool Server::ProtocolEnabled(const char * name) {
+ if (!_options.enabled_protocols.empty() &&
+ _options.enabled_protocols.find(name) == std::string::npos) {
Review Comment:
是不是可以判断协议是否以h2开头,避免其他协议名字包含了h2,导致误判?
##########
src/brpc/server.cpp:
##########
@@ -565,13 +565,22 @@ int Server::AddBuiltinServices() {
LOG(ERROR) << "Fail to add GetJsService";
return -1;
}
- if (AddBuiltinService(new (std::nothrow) GrpcHealthCheckService)) {
+ if (ProtocolEnabled("h2") &&
+ AddBuiltinService(new (std::nothrow) GrpcHealthCheckService)) {
LOG(ERROR) << "Fail to add GrpcHealthCheckService";
return -1;
}
return 0;
}
+bool Server::ProtocolEnabled(const char * name) {
+ if (!_options.enabled_protocols.empty() &&
+ _options.enabled_protocols.find(name) == std::string::npos) {
Review Comment:
是不是可以判断协议是否以h2开头,避免其他协议名字包含了h2导致误判的问题?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]