zyearn commented on a change in pull request #1320:
URL: https://github.com/apache/incubator-brpc/pull/1320#discussion_r552973735



##########
File path: test/brpc_naming_service_unittest.cpp
##########
@@ -579,6 +579,14 @@ class DiscoveryNamingServiceImpl : public 
test::DiscoveryNamingService {
                  google::protobuf::Closure* done) {
         brpc::ClosureGuard done_guard(done);
         brpc::Controller* cntl = static_cast<brpc::Controller*>(cntl_base);
+        auto body = cntl->request_attachment().to_string();
+        for (brpc::QuerySplitter sp(body); sp; ++sp) {
+            if (!sp.key().empty()) {

Review comment:
       I would suggest this line can be deleted.

##########
File path: src/brpc/policy/discovery_naming_service.cpp
##########
@@ -271,9 +272,15 @@ int DiscoveryClient::DoRegister() {
     cntl.http_request().set_content_type("application/x-www-form-urlencoded");
     butil::IOBufBuilder os;
     os << "appid=" << _params.appid
-        << "&hostname=" << _params.hostname
-        << "&addrs=" << _params.addrs
-        << "&env=" << _params.env
+        << "&hostname=" << _params.hostname;
+
+    std::vector<butil::StringPiece> addrs;
+    butil::SplitString(_params.addrs, ',', &addrs);
+    for (size_t i = 0; i < addrs.size(); ++i) {
+        os << "&addrs=" << addrs[i];
+    }

Review comment:
       According to the comment of butil::SplitString: If several instances of 
|c| are contiguous, or if |str| begins with or ends with |c|, then an empty 
string is inserted, we should check if addrs[i] is empty string.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to