[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-windows
Subject: [Kde-windows] dcopserver only accepts one coneection on win32
From: Christian Ehrlicher <Ch.Ehrlicher () gmx ! de>
Date: 2005-12-08 20:41:48
Message-ID: 43989A8C.10701 () gmx ! de
[Download RAW message or body]
[Attachment #2 (multipart/signed)]
[Attachment #4 (multipart/mixed)]
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
["dcop2.patch" (text/x-diff)]
Index: dcopserver.cpp
===================================================================
--- dcopserver.cpp (revision 486802)
+++ dcopserver.cpp (working copy)
@@ -440,6 +440,7 @@
: QSocketNotifier( IceConnectionNumber( conn ),
QSocketNotifier::Read, 0 )
{
+ setEnabled(false);
iceConn = conn;
notifyRegister = 0;
_signalConnectionList = 0;
@@ -1153,8 +1154,11 @@
void DCOPServer::processData( int /*socket*/ )
{
- IceConn iceConn = static_cast<const DCOPConnection*>(sender())->iceConn;
+ DCOPConnection *s = static_cast<DCOPConnection*>( sender() );
+ IceConn iceConn = s->iceConn;
+ s->setEnabled(false);
IceProcessMessagesStatus status = IceProcessMessages( iceConn, 0, 0 );
+ s->setEnabled(true);
if ( status == IceProcessMessagesIOError ) {
deadConnections.removeAll(iceConn);
if (deadConnections.isEmpty())
@@ -1191,6 +1195,7 @@
deadConnections.removeAll(iceConn);
(void) IceCloseConnection (iceConn);
}
+ clients.value( iceConn )->setEnabled(true);
}
void* DCOPServer::watchConnection( IceConn iceConn )
["signature.asc" (application/pgp-signature)]
_______________________________________________
Kde-windows mailing list
Kde-windows@kde.org
https://mail.kde.org/mailman/listinfo/kde-windows
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic