Skip to content

Commit 3a5ab12

Browse files
authored
dfly_bench: Show error on failing to make address (#5787)
* dfly_bench: Show error on failing to make address Sometimes when dfly_bench parses response to extract host, it failes during boost make_address. This error is thrown up the stack causing the program to fail without indication of what the error was. Changed to use the error_code variant of make_address to print the error clearly. Signed-off-by: Abhijat Malviya <[email protected]>
1 parent 1e29d9f commit 3a5ab12

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/server/dfly_bench.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -821,6 +821,7 @@ void Driver::ParseRESP() {
821821
RedisParser::Result result = RedisParser::OK;
822822
RespVec parse_args;
823823
constexpr string_view kMovedErrorKey = "MOVED"sv;
824+
boost::system::error_code ec;
824825

825826
do {
826827
result = parser_.Parse(io_buf_.InputBuffer(), &consumed, &parse_args);
@@ -840,7 +841,9 @@ void Driver::ParseRESP() {
840841
vector<string_view> addr_parts = absl::StrSplit(parts[1], ':');
841842
CHECK_EQ(2u, addr_parts.size());
842843

843-
auto host = ::boost::asio::ip::make_address(addr_parts[0]);
844+
auto host = boost::asio::ip::make_address(addr_parts[0], ec);
845+
CHECK(!ec) << "make_address failed with error: " << ec.message()
846+
<< " while parsing address " << addr_parts[0];
844847

845848
uint32_t port;
846849
CHECK(absl::SimpleAtoi(addr_parts[1], &port));

0 commit comments

Comments
 (0)