Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 14 additions & 9 deletions tools/rpc_replay/rpc_replay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include <brpc/serialized_request.h>
#include <brpc/nshead_message.h>
#include <brpc/details/http_message.h>
#include "brpc/options.pb.h"
#include "info_thread.h"

DEFINE_string(dir, "", "The directory of dumped requests");
Expand Down Expand Up @@ -82,21 +83,25 @@ int ChannelGroup::Init() {
}
_chans.resize(max_protocol_size + 1);
for (size_t i = 0; i < protocols.size(); ++i) {
if (protocols[i].second.support_client() &&
protocols[i].second.support_server()) {
const brpc::ProtocolType prot = protocols[i].first;
const brpc::ProtocolType protocol_type = protocols[i].first;
const brpc::Protocol protocol = protocols[i].second;
brpc::ChannelOptions options;
options.protocol = protocol_type;
options.connection_type = FLAGS_connection_type;
options.timeout_ms = FLAGS_timeout_ms/*milliseconds*/;
options.max_retry = FLAGS_max_retry;
if ((options.connection_type == brpc::CONNECTION_TYPE_UNKNOWN ||
options.connection_type & protocol.supported_connection_type) &&
protocol.support_client() &&
protocol.support_server()) {
brpc::Channel* chan = new brpc::Channel;
brpc::ChannelOptions options;
options.protocol = prot;
options.connection_type = FLAGS_connection_type;
options.timeout_ms = FLAGS_timeout_ms/*milliseconds*/;
options.max_retry = FLAGS_max_retry;
if (chan->Init(FLAGS_server.c_str(), FLAGS_load_balancer.c_str(),
&options) != 0) {
LOG(ERROR) << "Fail to initialize channel";
delete chan;
return -1;
}
_chans[prot] = chan;
_chans[protocol_type] = chan;
}
}
return 0;
Expand Down