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:
DarkWyrm 2004-08-08 22:35:25 +00:00
parent 3a340a8613
commit 38e110b124
3 changed files with 16 additions and 15 deletions

View File

@ -49,7 +49,7 @@ BAppServerLink::BAppServerLink(void)
if (be_app)
{
be_app->Lock();
SetSendPort(be_app->fServerTo);
SetSendPort(be_app->fServerFrom);
}
receiver=create_port(100,"AppServerLink reply port");
SetReplyPort(receiver);

View File

@ -740,11 +740,14 @@ void BApplication::InitData(const char* signature, status_t* error)
// check signature
fInitError = check_app_signature(signature);
fAppName = signature;
#ifndef RUN_WITHOUT_REGISTRAR
bool isRegistrar
= (signature && !strcasecmp(signature, kRegistrarSignature));
// get team and thread
team_id team = Team();
thread_id thread = BPrivate::main_thread_for(team);
#endif
// get app executable ref
entry_ref ref;
if (fInitError == B_OK)
@ -849,7 +852,7 @@ void BApplication::InitData(const char* signature, status_t* error)
#endif // ifdef RUN_WITHOUT_REGISTRAR
// TODO: Not completely sure about the order, but this should be close.
// An app_server connection is necessary for a lot of stuff, so get that first.
if (fInitError == B_OK)
connect_to_app_server();
@ -956,7 +959,7 @@ void BApplication::connect_to_app_server()
// 3) team_id - team identification field
// 4) int32 - handler ID token of the app
// 5) char * - signature of the regular app
BPortLink link(fServerFrom);
BPortLink link(fServerFrom,fServerTo);
int32 code=SERVER_FALSE;
link.StartMessage(AS_CREATE_APP);
@ -968,10 +971,10 @@ void BApplication::connect_to_app_server()
link.Flush();
link.GetNextReply(&code);
// Reply code: AS_CREATE_APP
// Reply code: AS_SET_SERVER_PORT
// Reply data:
// 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);
} else

View File

@ -59,7 +59,7 @@
// Local Includes --------------------------------------------------------------
// Local Defines ---------------------------------------------------------------
//#define DEBUG_WIN
#define DEBUG_WIN
#ifdef DEBUG_WIN
# include <stdio.h>
# define STRACE(x) printf x
@ -2182,12 +2182,12 @@ void BWindow::InitData( BRect frame, const char* title, window_look look,
}
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);
// 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
// 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
// we'll lock the be_app to be sure we're the only one writing at BApplication's server port
bool locked = false;
if ( !(be_app->IsLocked()) )
{
@ -2195,8 +2195,8 @@ void BWindow::InitData( BRect frame, const char* title, window_look look,
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;
fLink->StartMessage(AS_CREATE_WINDOW);
fLink->Attach<BRect>( fFrame );
@ -2206,9 +2206,7 @@ void BWindow::InitData( BRect frame, const char* title, window_look look,
fLink->Attach<uint32>( workspace );
fLink->Attach<int32>( _get_object_token_(this) );
fLink->Attach<port_id>( receive_port );
fLink->Attach<port_id>( fMsgPort );
fLink->AttachString( title );
fLink->Attach<port_id>(receive_port);
fLink->Flush();
send_port = -1;