BMessenger: support launch daemon when set to signature.

* Before asking the roster, we now ask the launch roster if it knows
  about the target.
This commit is contained in:
Axel Dörfler 2015-04-15 18:02:55 +02:00
parent e31148095d
commit d32061151e
1 changed files with 31 additions and 21 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright 2001-2011 Haiku, Inc. All rights reserved.
* Copyright 2001-2015 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
@ -7,26 +7,27 @@
*/
#include <AppMisc.h>
#include <AutoLocker.h>
#include <MessageUtils.h>
#include "TokenSpace.h"
#include <Application.h>
#include <Handler.h>
#include <Looper.h>
#include <LooperList.h>
#include <Message.h>
#include <MessagePrivate.h>
#include <Messenger.h>
#include <OS.h>
#include <Roster.h>
#include <TokenSpace.h>
#include <new>
#include <stdio.h>
#include <strings.h>
#include <Application.h>
#include <AutoLocker.h>
#include <Handler.h>
#include <Looper.h>
#include <Message.h>
#include <OS.h>
#include <Roster.h>
#include <AppMisc.h>
#include <LaunchRoster.h>
#include <LooperList.h>
#include <MessagePrivate.h>
#include <MessageUtils.h>
#include <TokenSpace.h>
// debugging
//#define DBG(x) x
@ -328,12 +329,21 @@ BMessenger::_InitData(const char* signature, team_id team, status_t* _result)
if (team < 0) {
// no team ID given
if (signature != NULL) {
// Try existing launch communication data first
BMessage data;
if (BLaunchRoster().GetData(signature, data) == B_OK) {
info.port = data.GetInt32("port", -1);
team = data.GetInt32("team", -5);
}
if (info.port < 0) {
result = be_roster->GetAppInfo(signature, &info);
team = info.team;
// B_ERROR means that no application with the given signature
// is running. But we are supposed to return B_BAD_VALUE.
if (result == B_ERROR)
result = B_BAD_VALUE;
} else
info.flags = 0;
} else
result = B_BAD_TYPE;
} else {