[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: Using multiple DCOP servers in one app
From:       Martijn Klingens <mklingens () yahoo ! com>
Date:       2001-12-29 18:58:57
[Download RAW message or body]

On Friday 28 December 2001 03:22, Martijn Klingens wrote:
> I'm trying to iterate through multiple DCOP servers, but I run into some
> problems, as soon as I try to contact the second server. I do the DCOP call
> in a loop that does
>
> 	    if( client.isAttached() )
> 		client.detach();
> 	    client.attach();

Ok, I found two workarounds to get rid of the problem, though I think it 
would be nice if these issues are fixed instead. Waldo, do you think you can 
fix this?

1. Change client from a DCOPClient local variable into a DCOPClient * and 
delete/new a new instance and the hangs are gone. New problem is then that 
you're still connecting to the first DCOP server and are not really 
connecting to the second. No idea why reusing an existing instance doesn't 
work (I tried it again after applying (2) but then it still doesn't work, it 
must be something else). Probably detach() doesn't leave the DCOPClient in 
the same state as the constructor does, but I haven't verified that.

2. After looking in the DCOP sources I knew why (1) alone is not enough: 
DCOPClientPrivate has a static member serverAddr which is not updated if I 
manually putenv() the $DCOPSERVER variable. I changed the code to use 
DCOPClient::setServerAddress() instead and now it works like a charm. If it 
is not too hard maybe it is still better to detect a changed environment 
variable, though, so a new DCOPClient makes use of it. Maybe the variable 
even shouldn't be static. My code doesn't use the two DCOP servers parallel, 
only one after another. I think using them simultaneously will break until 
the var is not static anymore, but that might be an incorrect conclusion of 
my part.

Martijn
 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic