dcopserver only accepts one coneection on win32

Ralf Habacker ralf.habacker at freenet.de
Tue Dec 20 21:50:31 GMT 2005


Christian Ehrlicher schrieb:

>Hi,
>
>we have a problem with dcopserver on win32 - it only accepts one
>connection. After a lot of debugging (I think I understand dcopserver
>now much better :-) ) I found out that there is a problem with
>QSocketNotifier. It just sends too much events and dcopserver gets into
>an endless loop in dcop/KDE-ICE/misc.c:259.
>
>The problem is the behaviour of WSAAsyncSelect used in qtcore to get
>notification that new data has arrived. I'll try to explain (or read
>http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winsock/winsock/wsaasyncselect_2.asp)
>the problem:
>
>client sends data -> WSAAsyncSelect creates an event ->
>DCOPServer::processData() -> server reads data -> server and client are
>communicating without a need for a socketnotifier -> ready -> because
>new data arrived, an new event is created -> processData() is called but
>can't read anything from the socket -> endless loop
>
>WSAAsyncSelect stops sending events until it is reenabled by calling the
>specific function. This means that I don't get an event until I called
>recv().
>
>But since DCOPServer::processData() sends and reads data, new events a
>created...
>My current hack is to disable the event notifier inside
>DCOPServer::processData() (see attached patch). I'm unsure if this is ok
>because I currently don't know what happens when new data arrives after
>I called recv() the last time but QSocketNotifier isn't enabled yet. If
>I get a notification, it will work, but if not, the server get out of
>sync/the client waits forever.
>
>I wonder how this worked with qt3 because there also WSAAsyncSelect is
>used (at least I use it for qt3/free because I found no solution how to
>get it working with select())
>  
>
Is there a working dcopserver with qt 3 ? It this would be true, there 
must a change in qt's behavior.

Ralf





More information about the kde-core-devel mailing list