Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ void ActiveMessageEncoderFilter::continueEncoding() {
ActiveMessage::ActiveMessage(ConnectionManager& parent)
: parent_(parent), request_timer_(std::make_unique<Stats::HistogramCompletableTimespanImpl>(
parent_.stats().request_time_ms_, parent.timeSystem())),
request_id_(-1), stream_id_(parent.randomGenerator().random()),
stream_id_(parent.randomGenerator().random()),
stream_info_(parent.timeSystem(), parent_.connection().connectionInfoProviderSharedPtr()),
pending_stream_decoded_(false), local_response_sent_(false) {
parent_.stats().request_active_.inc();
Expand Down Expand Up @@ -346,7 +346,6 @@ FilterStatus ActiveMessage::applyEncoderFilters(ActiveMessageEncoderFilter* filt

void ActiveMessage::sendLocalReply(const DubboFilters::DirectResponse& response, bool end_stream) {
ASSERT(metadata_);
metadata_->setRequestId(request_id_);
parent_.sendLocalReply(*metadata_, response, end_stream);

if (end_stream) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,6 @@ class ActiveMessage : public LinkedObject<ActiveMessage>,
std::list<ActiveMessageEncoderFilterPtr> encoder_filters_;
std::function<FilterStatus(DubboFilters::EncoderFilter*)> encoder_filter_action_;

int32_t request_id_;

// This value is used in the calculation of the weighted cluster.
uint64_t stream_id_;
StreamInfo::StreamInfoImpl stream_info_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -832,7 +832,7 @@ TEST_F(ConnectionManagerTest, ResponseWithUnknownSequenceID) {

TEST_F(ConnectionManagerTest, OnDataWithFilterSendsLocalReply) {
initializeFilter();
writeHessianRequestMessage(buffer_, false, false, 1);
writeHessianRequestMessage(buffer_, false, false, 233333);

config_->setupFilterChain(2, 0);
config_->expectOnDestroy();
Expand All @@ -847,8 +847,10 @@ TEST_F(ConnectionManagerTest, OnDataWithFilterSendsLocalReply) {
const std::string fake_response("mock dubbo response");
NiceMock<DubboFilters::MockDirectResponse> direct_response;
EXPECT_CALL(direct_response, encode(_, _, _))
.WillOnce(Invoke([&](MessageMetadata&, Protocol&,
.WillOnce(Invoke([&](MessageMetadata& metadata, Protocol&,
Buffer::Instance& buffer) -> DubboFilters::DirectResponse::ResponseType {
// Validate request id.
EXPECT_EQ(metadata.requestId(), 233333);
buffer.add(fake_response);
return DubboFilters::DirectResponse::ResponseType::SuccessReply;
}));
Expand Down Expand Up @@ -878,7 +880,7 @@ TEST_F(ConnectionManagerTest, OnDataWithFilterSendsLocalReply) {

TEST_F(ConnectionManagerTest, OnDataWithFilterSendsLocalErrorReply) {
initializeFilter();
writeHessianRequestMessage(buffer_, false, false, 1);
writeHessianRequestMessage(buffer_, false, false, 233334);

config_->setupFilterChain(2, 0);
config_->expectOnDestroy();
Expand All @@ -893,8 +895,10 @@ TEST_F(ConnectionManagerTest, OnDataWithFilterSendsLocalErrorReply) {
const std::string fake_response("mock dubbo response");
NiceMock<DubboFilters::MockDirectResponse> direct_response;
EXPECT_CALL(direct_response, encode(_, _, _))
.WillOnce(Invoke([&](MessageMetadata&, Protocol&,
.WillOnce(Invoke([&](MessageMetadata& metadata, Protocol&,
Buffer::Instance& buffer) -> DubboFilters::DirectResponse::ResponseType {
// Validate request id.
EXPECT_EQ(metadata.requestId(), 233334);
buffer.add(fake_response);
return DubboFilters::DirectResponse::ResponseType::ErrorReply;
}));
Expand Down