@@ -71,16 +71,16 @@ class FakeStream : public Http::RequestDecoder,
71
71
FakeStream (FakeHttpConnection& parent, Http::ResponseEncoder& encoder,
72
72
Event::TestTimeSystem& time_system);
73
73
74
- uint64_t bodyLength () {
74
+ uint64_t bodyLength () const {
75
75
absl::MutexLock lock (&lock_);
76
76
return body_.length ();
77
77
}
78
- std::unique_ptr<Buffer::Instance> body () {
78
+ std::unique_ptr<Buffer::Instance> body () const {
79
79
absl::MutexLock lock (&lock_);
80
- auto body = std::make_unique<Buffer::OwnedImpl>(static_cast <Buffer::Instance&>(body_));
80
+ auto body = std::make_unique<Buffer::OwnedImpl>(static_cast <const Buffer::Instance&>(body_));
81
81
return body;
82
82
}
83
- bool complete () {
83
+ bool complete () const {
84
84
absl::MutexLock lock (&lock_);
85
85
return end_stream_;
86
86
}
@@ -98,18 +98,21 @@ class FakeStream : public Http::RequestDecoder,
98
98
void encodeResetStream ();
99
99
void encodeMetadata (const Http::MetadataMapVector& metadata_map_vector);
100
100
void readDisable (bool disable);
101
- Http::RequestHeaderMapConstSharedPtr headers () {
101
+ Http::RequestHeaderMapConstSharedPtr headers () const {
102
102
absl::MutexLock lock (&lock_);
103
103
Http::RequestHeaderMapConstSharedPtr headers{headers_};
104
104
return headers;
105
105
}
106
106
void setAddServedByHeader (bool add_header) { add_served_by_header_ = add_header; }
107
- Http::RequestTrailerMapConstSharedPtr trailers () {
107
+ Http::RequestTrailerMapConstSharedPtr trailers () const {
108
108
absl::MutexLock lock (&lock_);
109
109
Http::RequestTrailerMapConstSharedPtr trailers{trailers_};
110
110
return trailers;
111
111
}
112
- bool receivedData () { return received_data_; }
112
+ bool receivedData () const {
113
+ absl::MutexLock lock (&lock_);
114
+ return received_data_;
115
+ }
113
116
Http::Http1StreamEncoderOptionsOptRef http1StreamEncoderOptions () {
114
117
return encoder_.http1StreamEncoderOptions ();
115
118
}
@@ -256,7 +259,7 @@ class FakeStream : public Http::RequestDecoder,
256
259
}
257
260
258
261
protected:
259
- absl::Mutex lock_;
262
+ mutable absl::Mutex lock_;
260
263
Http::RequestHeaderMapSharedPtr headers_ ABSL_GUARDED_BY (lock_);
261
264
Buffer::OwnedImpl body_ ABSL_GUARDED_BY (lock_);
262
265
FakeHttpConnection& parent_;
@@ -274,7 +277,7 @@ class FakeStream : public Http::RequestDecoder,
274
277
absl::node_hash_map<std::string, uint64_t > duplicated_metadata_key_count_;
275
278
std::shared_ptr<StreamInfo::StreamInfo> stream_info_;
276
279
AccessLog::InstanceSharedPtrVector access_log_handlers_;
277
- bool received_data_{false };
280
+ bool received_data_ ABSL_GUARDED_BY (lock_) {false };
278
281
bool grpc_stream_started_{false };
279
282
Http::ServerHeaderValidatorPtr header_validator_;
280
283
};
0 commit comments