dcopserver only accepts one coneection on win32

Christian Ehrlicher Ch.Ehrlicher at gmx.de
Thu Dec 8 20:41:48 GMT 2005


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())

Christian


-------------- next part --------------
A non-text attachment was scrubbed...
Name: dcop2.patch
Type: text/x-diff
Size: 1109 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20051208/89781c21/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 250 bytes
Desc: OpenPGP digital signature
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20051208/89781c21/attachment.sig>


More information about the kde-core-devel mailing list