chenBright commented on code in PR #3163:
URL: https://github.com/apache/brpc/pull/3163#discussion_r2596134794
##########
src/brpc/controller.cpp:
##########
@@ -174,6 +175,80 @@ class IgnoreAllRead : public ProgressiveReader {
void OnEndOfMessage(const butil::Status&) {}
};
+class ProgressiveTimeoutReader : public ProgressiveReader {
+public:
+ explicit ProgressiveTimeoutReader(SocketId id, int32_t read_timeout_ms,
ProgressiveReader* reader):
+ _socket_id(id),
+ _read_timeout_ms(read_timeout_ms),
+ _reader(reader),
+ _timeout_id(0),
+ _is_read_timeout(false) {
+ AddIdleReadTimeoutMonitor();
+ }
+
+ ~ProgressiveTimeoutReader() {
+ if(_timeout_id > 0) {
+ bthread_timer_del(_timeout_id);
+ }
+ }
+
+ butil::Status OnReadOnePart(const void* data, size_t length) {
+ return _reader->OnReadOnePart(data, length);
+ }
+
+ void OnEndOfMessage(const butil::Status& status) {
+ if (_is_read_timeout) {
+ _reader->OnEndOfMessage(butil::Status(ECONNRESET, "The progressive
read timeout"));
Review Comment:
Use EProgReadTimeout(1019) instead of ECONNRESET, and add it it to
errno.proto.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]