wwbmmm commented on code in PR #1804: URL: https://github.com/apache/incubator-brpc/pull/1804#discussion_r901276239
########## src/brpc/stream.cpp: ########## @@ -462,8 +462,12 @@ class MessageBatcher { ~MessageBatcher() { flush(); } void flush() { if (_size > 0 && _s->_options.handler != NULL) { - _s->_options.handler->on_received_messages( + int ret = _s->_options.handler->on_received_messages( _s->id(), _storage, _size); + if (BAIDU_UNLIKELY(ret != 0)) { + LOG(WARNING) << "Fail to receive message for stream: " << _s->id(); + _s->_options.handler->on_failure(_s->id()); Review Comment: I think it's unnecessary to call `on_failure` here. Since user knows what will return from `on_received_messages`, they can call `on_failure` in `on_received_messages`. -- 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: dev-unsubscr...@brpc.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org For additional commands, e-mail: dev-h...@brpc.apache.org