forked from Silverfish/proton-bridge
GODT-1746: wait until frontend is ready
This commit is contained in:
@ -113,6 +113,10 @@ func NewService(
|
|||||||
firstTimeAutostart: sync.Once{},
|
firstTimeAutostart: sync.Once{},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Initializing.Done is only called sync.Once. Please keep the increment
|
||||||
|
// set to 1
|
||||||
|
s.initializing.Add(1)
|
||||||
|
|
||||||
config, err := tls.GetConfig()
|
config, err := tls.GetConfig()
|
||||||
config.ClientAuth = cryptotls.NoClientCert // skip client auth if the certificate allow it.
|
config.ClientAuth = cryptotls.NoClientCert // skip client auth if the certificate allow it.
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -191,7 +195,9 @@ func (s *Service) NotifySilentUpdateError(err error) {
|
|||||||
_ = s.SendEvent(NewUpdateErrorEvent(UpdateErrorType_UPDATE_SILENT_ERROR))
|
_ = s.SendEvent(NewUpdateErrorEvent(UpdateErrorType_UPDATE_SILENT_ERROR))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Service) WaitUntilFrontendIsReady() {}
|
func (s *Service) WaitUntilFrontendIsReady() {
|
||||||
|
s.initializing.Wait()
|
||||||
|
}
|
||||||
|
|
||||||
func (s *Service) watchEvents() { // nolint:funlen
|
func (s *Service) watchEvents() { // nolint:funlen
|
||||||
if s.bridge.HasError(bridge.ErrLocalCacheUnavailable) {
|
if s.bridge.HasError(bridge.ErrLocalCacheUnavailable) {
|
||||||
|
|||||||
@ -69,7 +69,8 @@ func (s *Service) AddLogEntry(_ context.Context, request *AddLogEntryRequest) (*
|
|||||||
// GuiReady implement the GuiReady gRPC service call.
|
// GuiReady implement the GuiReady gRPC service call.
|
||||||
func (s *Service) GuiReady(context.Context, *emptypb.Empty) (*emptypb.Empty, error) {
|
func (s *Service) GuiReady(context.Context, *emptypb.Empty) (*emptypb.Empty, error) {
|
||||||
s.log.Info("GuiReady")
|
s.log.Info("GuiReady")
|
||||||
// Note nothing to be done. old Qt frontend had a sync.one
|
// sync.one
|
||||||
|
s.initializationDone.Do(s.initializing.Done)
|
||||||
return &emptypb.Empty{}, nil
|
return &emptypb.Empty{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user