zchuang185 commented on code in PR #3163:
URL: https://github.com/apache/brpc/pull/3163#discussion_r2583883657
##########
src/brpc/controller.cpp:
##########
@@ -1542,6 +1660,9 @@ void
Controller::ReadProgressiveAttachmentBy(ProgressiveReader* r) {
__FUNCTION__));
}
add_flag(FLAGS_PROGRESSIVE_READER);
+ if (progressive_read_timeout_ms() > 0) {
+ return _rpa->ReadProgressiveAttachmentBy(new
ProgressiveTimeoutRead(this, r));
Review Comment:
@wwbmmm I tried to obtain the socket using the virtual getSocket() function,
it only get a null pointer. Then I attempted to assign the socketId in the
http_rpc_protocol ParseHttpMessage function, and it worked properly.
just like this:
`
class ReadableProgressiveAttachment : public SharedObject {
public:
virtual void ReadProgressiveAttachmentBy(ProgressiveReader* r) = 0;
virtual SocketId GetSocketId() = 0;
virtual void SetSocketId(SocketId id) = 0;
};
`
`
ParseResult ParseHttpMessage(butil::IOBuf *source, Socket *socket,
bool read_eof, const void* arg) {
xxx
if (http_imsg == NULL) {
LOG(FATAL) << "Fail to new HttpContext";
return MakeParseError(PARSE_ERROR_NO_RESOURCE);
}
http_imsg->SetSocketId(socket->id());
xxx
}
`
--
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]