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:
parent
e31148095d
commit
d32061151e
|
@ -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.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* 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 <Messenger.h>
|
||||||
#include <OS.h>
|
|
||||||
#include <Roster.h>
|
|
||||||
#include <TokenSpace.h>
|
|
||||||
|
|
||||||
#include <new>
|
#include <new>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <strings.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
|
// debugging
|
||||||
//#define DBG(x) x
|
//#define DBG(x) x
|
||||||
|
@ -328,12 +329,21 @@ BMessenger::_InitData(const char* signature, team_id team, status_t* _result)
|
||||||
if (team < 0) {
|
if (team < 0) {
|
||||||
// no team ID given
|
// no team ID given
|
||||||
if (signature != NULL) {
|
if (signature != NULL) {
|
||||||
result = be_roster->GetAppInfo(signature, &info);
|
// Try existing launch communication data first
|
||||||
team = info.team;
|
BMessage data;
|
||||||
// B_ERROR means that no application with the given signature
|
if (BLaunchRoster().GetData(signature, data) == B_OK) {
|
||||||
// is running. But we are supposed to return B_BAD_VALUE.
|
info.port = data.GetInt32("port", -1);
|
||||||
if (result == B_ERROR)
|
team = data.GetInt32("team", -5);
|
||||||
result = B_BAD_VALUE;
|
}
|
||||||
|
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
|
} else
|
||||||
result = B_BAD_TYPE;
|
result = B_BAD_TYPE;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue