Skip to content

Commit d9d74a0

Browse files
committed
curvebs/client: mds address should not be empty
Signed-off-by: Hanqing Wu <[email protected]>
1 parent 1822d49 commit d9d74a0

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/client/client_config.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,12 @@ int ClientConfig::Init(const std::string& configpath) {
184184

185185
std::vector<std::string> mdsAddr;
186186
common::SplitString(metaAddr, ",", &mdsAddr);
187+
if (mdsAddr.empty()) {
188+
LOG(ERROR) << "mds.listen.addr seems invalid or empty, `" << metaAddr
189+
<< "`'";
190+
return -1;
191+
}
192+
187193
fileServiceOption_.metaServerOpt.rpcRetryOpt.addrs.assign(mdsAddr.begin(),
188194
mdsAddr.end());
189195
for (auto& addr : fileServiceOption_.metaServerOpt.rpcRetryOpt.addrs) {

src/client/mds_client.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,9 @@ int RPCExcutorRetryPolicy::GetNextMDSIndex(bool needChangeMDS,
191191

192192
int RPCExcutorRetryPolicy::ExcuteTask(int mdsindex, uint64_t rpcTimeOutMS,
193193
RPCFunc task) {
194+
assert(mdsindex >= 0 &&
195+
mdsindex < static_cast<int>(retryOpt_.addrs.size()));
196+
194197
const std::string &mdsaddr = retryOpt_.addrs[mdsindex];
195198

196199
brpc::Channel channel;

0 commit comments

Comments
 (0)