From 811f0164a0edc6c7be1fa43f4e16234cfaa2f70a Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Fri, 21 Aug 2015 23:03:37 +0200 Subject: [PATCH] BRoster: Make sure we aren't the registrar when initializing. This fixes a regression introduced in 9bfc833, where the old way of getting the roster port was replaced with its launch_daemon counterpart. The previous method of finding the roster did always fail when running from the registrar, as at the time of initialization (initialize_before of libbe) the registrar looper doesn't exist yet. This commit restores the previous behaviour by checking if the returned registrar team is the current team and avoiding initialization in that case. The regression caused a 5 second boot delay when later BApplication initialization of the registrar tried to communicate with itself with a reply timeout of that length. Fixes #12258 at least partially and might affect #12237. --- src/kits/app/Roster.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/kits/app/Roster.cpp b/src/kits/app/Roster.cpp index dc6a914107..1a8c76900b 100644 --- a/src/kits/app/Roster.cpp +++ b/src/kits/app/Roster.cpp @@ -2607,9 +2607,13 @@ BRoster::_InitMessenger() BMessage data; if (BLaunchRoster().GetData("application/x-vnd.Haiku-registrar", data) == B_OK) { + port_id port = data.GetInt32("port", -1); team_id team = data.GetInt32("team", -1); - if (port >= 0) { + + if (port >= 0 && team != current_team()) { + // Make sure we aren't the registrar ourselves. + DBG(OUT(" found roster port\n")); BMessenger::Private(fMessenger).SetTo(team, port,