Client-server messaging fixes
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8543 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -49,7 +49,7 @@ BAppServerLink::BAppServerLink(void)
|
|||||||
if (be_app)
|
if (be_app)
|
||||||
{
|
{
|
||||||
be_app->Lock();
|
be_app->Lock();
|
||||||
SetSendPort(be_app->fServerTo);
|
SetSendPort(be_app->fServerFrom);
|
||||||
}
|
}
|
||||||
receiver=create_port(100,"AppServerLink reply port");
|
receiver=create_port(100,"AppServerLink reply port");
|
||||||
SetReplyPort(receiver);
|
SetReplyPort(receiver);
|
||||||
|
|||||||
@@ -740,11 +740,14 @@ void BApplication::InitData(const char* signature, status_t* error)
|
|||||||
// check signature
|
// check signature
|
||||||
fInitError = check_app_signature(signature);
|
fInitError = check_app_signature(signature);
|
||||||
fAppName = signature;
|
fAppName = signature;
|
||||||
|
|
||||||
|
#ifndef RUN_WITHOUT_REGISTRAR
|
||||||
bool isRegistrar
|
bool isRegistrar
|
||||||
= (signature && !strcasecmp(signature, kRegistrarSignature));
|
= (signature && !strcasecmp(signature, kRegistrarSignature));
|
||||||
// get team and thread
|
// get team and thread
|
||||||
team_id team = Team();
|
team_id team = Team();
|
||||||
thread_id thread = BPrivate::main_thread_for(team);
|
thread_id thread = BPrivate::main_thread_for(team);
|
||||||
|
#endif
|
||||||
// get app executable ref
|
// get app executable ref
|
||||||
entry_ref ref;
|
entry_ref ref;
|
||||||
if (fInitError == B_OK)
|
if (fInitError == B_OK)
|
||||||
@@ -956,7 +959,7 @@ void BApplication::connect_to_app_server()
|
|||||||
// 3) team_id - team identification field
|
// 3) team_id - team identification field
|
||||||
// 4) int32 - handler ID token of the app
|
// 4) int32 - handler ID token of the app
|
||||||
// 5) char * - signature of the regular app
|
// 5) char * - signature of the regular app
|
||||||
BPortLink link(fServerFrom);
|
BPortLink link(fServerFrom,fServerTo);
|
||||||
int32 code=SERVER_FALSE;
|
int32 code=SERVER_FALSE;
|
||||||
|
|
||||||
link.StartMessage(AS_CREATE_APP);
|
link.StartMessage(AS_CREATE_APP);
|
||||||
@@ -968,10 +971,10 @@ void BApplication::connect_to_app_server()
|
|||||||
link.Flush();
|
link.Flush();
|
||||||
link.GetNextReply(&code);
|
link.GetNextReply(&code);
|
||||||
|
|
||||||
// Reply code: AS_CREATE_APP
|
// Reply code: AS_SET_SERVER_PORT
|
||||||
// Reply data:
|
// Reply data:
|
||||||
// 1) port_id server-side application port (fServerFrom value)
|
// 1) port_id server-side application port (fServerFrom value)
|
||||||
if(code==AS_CREATE_APP)
|
if(code==AS_SET_SERVER_PORT)
|
||||||
link.Read<port_id>(&fServerFrom);
|
link.Read<port_id>(&fServerFrom);
|
||||||
|
|
||||||
} else
|
} else
|
||||||
|
|||||||
@@ -59,7 +59,7 @@
|
|||||||
// Local Includes --------------------------------------------------------------
|
// Local Includes --------------------------------------------------------------
|
||||||
|
|
||||||
// Local Defines ---------------------------------------------------------------
|
// Local Defines ---------------------------------------------------------------
|
||||||
//#define DEBUG_WIN
|
#define DEBUG_WIN
|
||||||
#ifdef DEBUG_WIN
|
#ifdef DEBUG_WIN
|
||||||
# include <stdio.h>
|
# include <stdio.h>
|
||||||
# define STRACE(x) printf x
|
# define STRACE(x) printf x
|
||||||
@@ -2182,9 +2182,9 @@ void BWindow::InitData( BRect frame, const char* title, window_look look,
|
|||||||
}
|
}
|
||||||
|
|
||||||
STRACE(("BWindow::InitData(): contacting app_server...\n"));
|
STRACE(("BWindow::InitData(): contacting app_server...\n"));
|
||||||
// let app_server to know that a window has been created.
|
|
||||||
|
|
||||||
fLink = new BPortLink(be_app->fServerTo, receive_port);
|
// let app_server to know that a window has been created.
|
||||||
|
fLink = new BPortLink(be_app->fServerFrom, receive_port);
|
||||||
|
|
||||||
// HERE we are in BApplication's thread, so for locking we use be_app variable
|
// HERE we are in BApplication's thread, so for locking we use be_app variable
|
||||||
// we'll lock the be_app to be sure we're the only one writing at BApplication's server port
|
// we'll lock the be_app to be sure we're the only one writing at BApplication's server port
|
||||||
@@ -2195,7 +2195,7 @@ void BWindow::InitData( BRect frame, const char* title, window_look look,
|
|||||||
locked = true;
|
locked = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
STRACE(("be_app->fServerTo is %ld\n", be_app->fServerTo));
|
STRACE(("be_app->fServerTo is %ld\n", be_app->fServerFrom));
|
||||||
|
|
||||||
status_t err;
|
status_t err;
|
||||||
fLink->StartMessage(AS_CREATE_WINDOW);
|
fLink->StartMessage(AS_CREATE_WINDOW);
|
||||||
@@ -2206,9 +2206,7 @@ void BWindow::InitData( BRect frame, const char* title, window_look look,
|
|||||||
fLink->Attach<uint32>( workspace );
|
fLink->Attach<uint32>( workspace );
|
||||||
fLink->Attach<int32>( _get_object_token_(this) );
|
fLink->Attach<int32>( _get_object_token_(this) );
|
||||||
fLink->Attach<port_id>( receive_port );
|
fLink->Attach<port_id>( receive_port );
|
||||||
fLink->Attach<port_id>( fMsgPort );
|
|
||||||
fLink->AttachString( title );
|
fLink->AttachString( title );
|
||||||
fLink->Attach<port_id>(receive_port);
|
|
||||||
fLink->Flush();
|
fLink->Flush();
|
||||||
|
|
||||||
send_port = -1;
|
send_port = -1;
|
||||||
|
|||||||
Reference in New Issue
Block a user