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.
This commit is contained in:
Michael Lotz 2015-08-21 23:03:37 +02:00
parent 5ca445dfc6
commit 811f0164a0
1 changed files with 5 additions and 1 deletions

View File

@ -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,