mirror of https://github.com/qt/qtgrpc.git
Http2Handler: let finish() stop the deadlineTimer
It's the single point where a RPC finishes and the correct place to stop the timer. Pick-to: 6.10 6.9 6.8 Change-Id: I2965a938da32a8d78ccfb48f7f5ad37f63ee4363 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
This commit is contained in:
parent
02c989e3e0
commit
528469eece
|
|
@ -435,7 +435,6 @@ Http2Handler::Http2Handler(QGrpcHttp2ChannelPrivate *parent, QGrpcOperationConte
|
|||
&Http2Handler::writeMessage);
|
||||
}
|
||||
|
||||
connect(context, &QGrpcOperationContext::finished, &m_deadlineTimer, &QTimer::stop);
|
||||
m_deadlineTimer.setSingleShot(true);
|
||||
|
||||
writeMessage(context->argument());
|
||||
|
|
@ -696,6 +695,7 @@ void Http2Handler::finish(const QGrpcStatus &status)
|
|||
return;
|
||||
if (m_state != State::Cancelled) // don't overwrite the Cancelled state
|
||||
m_state = State::Finished;
|
||||
m_deadlineTimer.stop();
|
||||
emit m_context->finished(status);
|
||||
deleteLater();
|
||||
}
|
||||
|
|
@ -713,9 +713,6 @@ void Http2Handler::cancelWithStatus(const QGrpcStatus &status)
|
|||
qCDebug(lcStream, "[%p] Cancelling (state=%s)", this, QDebug::toBytes(m_state).data());
|
||||
m_state = State::Cancelled;
|
||||
|
||||
// Client cancelled the stream before the deadline exceeded.
|
||||
m_deadlineTimer.stop();
|
||||
|
||||
// Immediate cancellation by sending the RST_STREAM frame.
|
||||
if (m_stream && !m_stream->sendRST_STREAM(Http2::Http2Error::CANCEL)) {
|
||||
qCDebug(lcStream, "[%p] Failed cancellation (stream=%p)", this, m_stream.get());
|
||||
|
|
|
|||
Loading…
Reference in New Issue