From 38e110b12471ed04e0818ca31c85619880290a5c Mon Sep 17 00:00:00 2001 From: DarkWyrm Date: Sun, 8 Aug 2004 22:35:25 +0000 Subject: [PATCH] Client-server messaging fixes git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8543 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/app/AppServerLink.cpp | 2 +- src/kits/app/Application.cpp | 11 +++++++---- src/kits/interface/Window.cpp | 18 ++++++++---------- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/kits/app/AppServerLink.cpp b/src/kits/app/AppServerLink.cpp index a1f220e301..ae63c790c9 100644 --- a/src/kits/app/AppServerLink.cpp +++ b/src/kits/app/AppServerLink.cpp @@ -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); diff --git a/src/kits/app/Application.cpp b/src/kits/app/Application.cpp index 3eb92cd24c..c7d51bd221 100644 --- a/src/kits/app/Application.cpp +++ b/src/kits/app/Application.cpp @@ -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(&fServerFrom); } else diff --git a/src/kits/interface/Window.cpp b/src/kits/interface/Window.cpp index c9d8237f47..a925f5d13b 100644 --- a/src/kits/interface/Window.cpp +++ b/src/kits/interface/Window.cpp @@ -59,7 +59,7 @@ // Local Includes -------------------------------------------------------------- // Local Defines --------------------------------------------------------------- -//#define DEBUG_WIN +#define DEBUG_WIN #ifdef DEBUG_WIN # include # 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( fFrame ); @@ -2206,9 +2206,7 @@ void BWindow::InitData( BRect frame, const char* title, window_look look, fLink->Attach( workspace ); fLink->Attach( _get_object_token_(this) ); fLink->Attach( receive_port ); - fLink->Attach( fMsgPort ); fLink->AttachString( title ); - fLink->Attach(receive_port); fLink->Flush(); send_port = -1;