[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: PATCH: DCOPServer hanging on non responding client.
From: Waldo Bastian <bastian () kde ! org>
Date: 2001-01-23 23:44:46
[Download RAW message or body]
The following patch seems to solve this problem beyond my wildest
expectations.
Cheers,
Waldo
--
bastian@kde.org | SuSE Labs KDE Developer | bastian@suse.com
["dcopserver.patch" (text/x-c++)]
Index: dcopserver.cpp
===================================================================
RCS file: /home/kde/kdelibs/dcop/dcopserver.cpp,v
retrieving revision 1.115
diff -u -r1.115 dcopserver.cpp
--- dcopserver.cpp 2001/01/14 17:00:42 1.115
+++ dcopserver.cpp 2001/01/23 23:03:12
@@ -38,6 +38,7 @@
#include <stdlib.h>
#include <signal.h>
#include <unistd.h>
+#include <fcntl.h>
#ifdef HAVE_LIMITS_H
#include <limits.h>
#endif
@@ -57,6 +58,15 @@
template class QPtrDict<DCOPConnection>;
template class QList<DCOPListener>;
+#define _DCOPIceSendBegin(x) \
+ int fd = IceConnectionNumber( x ); \
+ long fd_fl = fcntl(fd, F_GETFL, 0); \
+ fcntl(fd, F_SETFL, fd_fl | O_NDELAY);
+#define _DCOPIceSendEnd() \
+ fcntl(fd, F_SETFL, fd_fl);
+
+
+
static bool only_local = false;
static Bool HostBasedAuthProc ( char* /*hostname*/)
@@ -459,7 +469,9 @@
sizeof(DCOPMsg), DCOPMsg, pMsg );
pMsg->key = key;
pMsg->length += datalen;
+ _DCOPIceSendBegin( target->iceConn );
IceSendData(target->iceConn, datalen, (char *) ba.data());
+ _DCOPIceSendEnd();
} else if ( toApp == "DCOPServer" ) {
QCString obj, fun;
QByteArray data;
@@ -481,7 +493,9 @@
sizeof(DCOPMsg), DCOPMsg, pMsg);
pMsg->key = key;
pMsg->length += datalen;
+ _DCOPIceSendBegin( client->iceConn );
IceSendData(client->iceConn, datalen, const_cast<char *>(ba.data()) );
+ _DCOPIceSendEnd();
}
}
}
@@ -509,8 +523,10 @@
sizeof(DCOPMsg), DCOPMsg, pMsg );
pMsg->key = key;
pMsg->length += datalen;
+ _DCOPIceSendBegin( target->iceConn );
IceSendData(target->iceConn, datalen, const_cast<char *>(ba.data()) );
IceFlush( target->iceConn );
+ _DCOPIceSendEnd();
} else {
QCString replyType;
QByteArray replyData;
@@ -537,8 +553,10 @@
else
pMsg->key = serverKey++;
pMsg->length += replylen;
+ _DCOPIceSendBegin( iceConn );
IceSendData( iceConn, reply.size(), const_cast<char *>(reply.data()) );
IceSendData( iceConn, replyData.size(), const_cast<char *>(replyData.data()) );
+ _DCOPIceSendEnd();
} else {
QByteArray reply;
QDataStream replyStream( reply, IO_WriteOnly );
@@ -550,7 +568,9 @@
else
pMsg->key = serverKey++;
pMsg->length += reply.size();
+ _DCOPIceSendBegin( iceConn );
IceSendData( iceConn, reply.size(), const_cast<char *>(reply.data()) );
+ _DCOPIceSendEnd();
}
}
}
@@ -588,7 +608,9 @@
sizeof(DCOPMsg), DCOPMsg, pMsg );
pMsg->key = key;
pMsg->length += datalen;
+ _DCOPIceSendBegin( connreply->iceConn );
IceSendData(connreply->iceConn, datalen, const_cast<char *>(ba.data()) );
+ _DCOPIceSendEnd();
}
}
break;
@@ -862,7 +884,9 @@
sizeof(DCOPMsg), DCOPMsg, pMsg );
pMsg->key = 1;
pMsg->length += reply.size();
+ _DCOPIceSendBegin( iceConn );
IceSendData( iceConn, reply.size(), const_cast<char *>(reply.data()));
+ _DCOPIceSendEnd();
if (!target)
qWarning("DCOP Error: unknown target in waitingForReply");
else if (!target->waitingOnReply.removeRef(conn->iceConn))
@@ -882,7 +906,9 @@
sizeof(DCOPMsg), DCOPMsg, pMsg );
pMsg->key = 1;
pMsg->length += reply.size();
+ _DCOPIceSendBegin( iceConn );
IceSendData( iceConn, reply.size(), const_cast<char *>(reply.data()));
+ _DCOPIceSendEnd();
if (!target)
qWarning("DCOP Error: unknown target in waitingForDelayedReply");
else if (!target->waitingOnReply.removeRef(conn->iceConn))
@@ -938,7 +964,9 @@
sizeof(DCOPMsg), DCOPMsg, pMsg );
pMsg->key = 1;
pMsg->length += datalen;
+ _DCOPIceSendBegin(c->iceConn);
IceSendData(c->iceConn, datalen, const_cast<char *>(ba.data()));
+ _DCOPIceSendEnd();
}
}
}
@@ -1169,7 +1197,9 @@
IceGetHeader( conn->iceConn, majorOpcode, DCOPSend,
sizeof(DCOPMsg), DCOPMsg, pMsg );
pMsg->length += datalen;
+ _DCOPIceSendBegin( conn->iceConn );
IceSendData(conn->iceConn, datalen, const_cast<char *>(ba.data()));
+ _DCOPIceSendEnd();
}
void IoErrorHandler ( IceConn iceConn)
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic