Revert "Fix for bug 6991, replace registrars timer tick"

Unintentional commit, still not used to gerrit things

This reverts commit a02e4534f5.
This commit is contained in:
Fredrik Holmqvist
2019-01-16 21:17:48 +01:00
parent ea0dc313dc
commit ffbedf6088
3 changed files with 16 additions and 17 deletions
+1
View File
@@ -96,6 +96,7 @@ enum {
B_REG_GET_MESSAGE_RUNNER_INFO = 'rgri', B_REG_GET_MESSAGE_RUNNER_INFO = 'rgri',
// internal registrar messages // internal registrar messages
B_REG_ROSTER_SANITY_EVENT = 'rgir',
B_REG_SHUTDOWN_FINISHED = 'rgsf', B_REG_SHUTDOWN_FINISHED = 'rgsf',
B_REG_ROSTER_DEVICE_RESCAN = 'rgrs', B_REG_ROSTER_DEVICE_RESCAN = 'rgrs',
+14 -17
View File
@@ -16,11 +16,9 @@
#include <Application.h> #include <Application.h>
#include <Clipboard.h> #include <Clipboard.h>
#include <Message.h> #include <Message.h>
#include <MessengerPrivate.h>
#include <OS.h> #include <OS.h>
#include <RegistrarDefs.h> #include <RegistrarDefs.h>
#include <RosterPrivate.h> #include <RosterPrivate.h>
#include <system_info.h>
#include "AuthenticationManager.h" #include "AuthenticationManager.h"
#include "ClipboardHandler.h" #include "ClipboardHandler.h"
@@ -49,6 +47,9 @@ using namespace BPrivate;
//! Name of the event queue. //! Name of the event queue.
static const char *kEventQueueName = "timer_thread"; static const char *kEventQueueName = "timer_thread";
//! Time interval between two roster sanity checks (1 s).
static const bigtime_t kRosterSanityEventInterval = 1000000LL;
/*! \brief Creates the registrar application class. /*! \brief Creates the registrar application class.
\param error Passed to the BApplication constructor for returning an \param error Passed to the BApplication constructor for returning an
@@ -62,6 +63,7 @@ Registrar::Registrar(status_t* _error)
fMIMEManager(NULL), fMIMEManager(NULL),
fEventQueue(NULL), fEventQueue(NULL),
fMessageRunnerManager(NULL), fMessageRunnerManager(NULL),
fSanityEvent(NULL),
fShutdownProcess(NULL), fShutdownProcess(NULL),
fAuthenticationManager(NULL), fAuthenticationManager(NULL),
fPackageWatchingManager(NULL) fPackageWatchingManager(NULL)
@@ -86,6 +88,7 @@ Registrar::~Registrar()
delete fPackageWatchingManager; delete fPackageWatchingManager;
delete fMessageRunnerManager; delete fMessageRunnerManager;
delete fEventQueue; delete fEventQueue;
delete fSanityEvent;
fMIMEManager->Lock(); fMIMEManager->Lock();
fMIMEManager->Quit(); fMIMEManager->Quit();
RemoveHandler(fClipboardHandler); RemoveHandler(fClipboardHandler);
@@ -169,15 +172,11 @@ Registrar::ReadyToRun()
// create the package watching manager // create the package watching manager
fPackageWatchingManager = new PackageWatchingManager; fPackageWatchingManager = new PackageWatchingManager;
// Sanity check roster after team deletion // create and schedule the sanity message event
BMessenger target(this); fSanityEvent = new MessageEvent(system_time() + kRosterSanityEventInterval,
BMessenger::Private messengerPrivate(target); this, B_REG_ROSTER_SANITY_EVENT);
fSanityEvent->SetAutoDelete(false);
port_id port = messengerPrivate.Port(); fEventQueue->AddEvent(fSanityEvent);
int32 token = messengerPrivate.Token();
__start_watching_system(-1, B_WATCH_SYSTEM_TEAM_DELETION, port, token);
//Clean up any early teams
fRoster->CheckSanity();
FUNCTION_END(); FUNCTION_END();
} }
@@ -353,13 +352,11 @@ Registrar::_MessageReceived(BMessage *message)
break; break;
// internal messages // internal messages
case B_SYSTEM_OBJECT_UPDATE: case B_REG_ROSTER_SANITY_EVENT:
{ fRoster->CheckSanity();
team_id team = (team_id)message->GetInt32("team", -1); fSanityEvent->SetTime(system_time() + kRosterSanityEventInterval);
if (team >= 0 && message->GetInt32("opcode", 0) == B_TEAM_DELETED) fEventQueue->AddEvent(fSanityEvent);
fRoster->HandleRemoveApp(message);
break; break;
}
case B_REG_SHUTDOWN_FINISHED: case B_REG_SHUTDOWN_FINISHED:
if (fShutdownProcess) { if (fShutdownProcess) {
fShutdownProcess->PostMessage(B_QUIT_REQUESTED, fShutdownProcess->PostMessage(B_QUIT_REQUESTED,
+1
View File
@@ -64,6 +64,7 @@ private:
MIMEManager *fMIMEManager; MIMEManager *fMIMEManager;
EventQueue *fEventQueue; EventQueue *fEventQueue;
MessageRunnerManager *fMessageRunnerManager; MessageRunnerManager *fMessageRunnerManager;
MessageEvent *fSanityEvent;
ShutdownProcess *fShutdownProcess; ShutdownProcess *fShutdownProcess;
AuthenticationManager *fAuthenticationManager; AuthenticationManager *fAuthenticationManager;
PackageWatchingManager *fPackageWatchingManager; PackageWatchingManager *fPackageWatchingManager;