mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-10 12:46:46 +00:00
Other: make GUI Tester more resilient to Bridge abrupt termination.
This commit is contained in:
@ -752,7 +752,7 @@ Status GRPCService::ConfigureUserAppleMail(ServerContext *, ConfigureAppleMailRe
|
|||||||
/// \param[in] writer The writer
|
/// \param[in] writer The writer
|
||||||
/// \return The status for the call.
|
/// \return The status for the call.
|
||||||
//****************************************************************************************************************************************************
|
//****************************************************************************************************************************************************
|
||||||
Status GRPCService::RunEventStream(ServerContext *, EventStreamRequest const *request, ServerWriter<StreamEvent> *writer) {
|
Status GRPCService::RunEventStream(ServerContext *ctx, EventStreamRequest const *request, ServerWriter<StreamEvent> *writer) {
|
||||||
app().log().debug(__FUNCTION__);
|
app().log().debug(__FUNCTION__);
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&eventStreamMutex_);
|
QMutexLocker locker(&eventStreamMutex_);
|
||||||
@ -767,19 +767,19 @@ Status GRPCService::RunEventStream(ServerContext *, EventStreamRequest const *re
|
|||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
QMutexLocker locker(&eventStreamMutex_);
|
QMutexLocker locker(&eventStreamMutex_);
|
||||||
if (eventStreamShouldStop_) {
|
if (eventStreamShouldStop_ || ctx->IsCancelled()) {
|
||||||
qtProxy_.setIsStreaming(false);
|
qtProxy_.setIsStreaming(false);
|
||||||
qtProxy_.setClientPlatform(QString());
|
qtProxy_.setClientPlatform(QString());
|
||||||
isStreaming_ = false;
|
isStreaming_ = false;
|
||||||
return Status::OK;
|
return Status::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (eventQueue_.isEmpty()) {
|
if (eventQueue_.isEmpty()) {
|
||||||
locker.unlock();
|
locker.unlock();
|
||||||
QThread::msleep(100);
|
QThread::msleep(100);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
SPStreamEvent const event = eventQueue_.front();
|
SPStreamEvent const event = eventQueue_.front();
|
||||||
eventQueue_.pop_front();
|
eventQueue_.pop_front();
|
||||||
locker.unlock();
|
locker.unlock();
|
||||||
|
|||||||
@ -93,7 +93,7 @@ public: // member functions.
|
|||||||
grpc::Status LogoutUser(::grpc::ServerContext *, ::google::protobuf::StringValue const *request, ::google::protobuf::Empty *) override;
|
grpc::Status LogoutUser(::grpc::ServerContext *, ::google::protobuf::StringValue const *request, ::google::protobuf::Empty *) override;
|
||||||
grpc::Status RemoveUser(::grpc::ServerContext *, ::google::protobuf::StringValue const *request, ::google::protobuf::Empty *) override;
|
grpc::Status RemoveUser(::grpc::ServerContext *, ::google::protobuf::StringValue const *request, ::google::protobuf::Empty *) override;
|
||||||
grpc::Status ConfigureUserAppleMail(::grpc::ServerContext *, ::grpc::ConfigureAppleMailRequest const *request, ::google::protobuf::Empty *) override;
|
grpc::Status ConfigureUserAppleMail(::grpc::ServerContext *, ::grpc::ConfigureAppleMailRequest const *request, ::google::protobuf::Empty *) override;
|
||||||
grpc::Status RunEventStream(::grpc::ServerContext *, ::grpc::EventStreamRequest const *request, ::grpc::ServerWriter<::grpc::StreamEvent> *writer) override;
|
grpc::Status RunEventStream(::grpc::ServerContext *ctx, ::grpc::EventStreamRequest const *request, ::grpc::ServerWriter<::grpc::StreamEvent> *writer) override;
|
||||||
grpc::Status StopEventStream(::grpc::ServerContext *, ::google::protobuf::Empty const *, ::google::protobuf::Empty *) override;
|
grpc::Status StopEventStream(::grpc::ServerContext *, ::google::protobuf::Empty const *, ::google::protobuf::Empty *) override;
|
||||||
|
|
||||||
bool sendEvent(bridgepp::SPStreamEvent const &event); ///< Queue an event for sending through the event stream.
|
bool sendEvent(bridgepp::SPStreamEvent const &event); ///< Queue an event for sending through the event stream.
|
||||||
|
|||||||
Reference in New Issue
Block a user