summaryrefslogtreecommitdiff
path: root/x11/ipc
authorzecke <zecke>2002-10-18 01:34:23 (UTC)
committer zecke <zecke>2002-10-18 01:34:23 (UTC)
commit0457c48c165abef8afa2ac73c8f66d20e289681a (patch) (side-by-side diff)
tree2c6baf363487d474df6ceeaf2ea17a351b38aa05 /x11/ipc
parente7e36afd3685c7fab146ebd0078d7f1a60f8c5e6 (diff)
downloadopie-0457c48c165abef8afa2ac73c8f66d20e289681a.zip
opie-0457c48c165abef8afa2ac73c8f66d20e289681a.tar.gz
opie-0457c48c165abef8afa2ac73c8f66d20e289681a.tar.bz2
Fix OCOPServer bugs... when removing clients
Implement the Opie side for the OK button now the awesome matchbox needs to get an update I was too excited about X11 so i did not do any PIM work yet
Diffstat (limited to 'x11/ipc') (more/less context) (ignore whitespace changes)
-rw-r--r--x11/ipc/server/ocopserver.cpp59
1 files changed, 35 insertions, 24 deletions
diff --git a/x11/ipc/server/ocopserver.cpp b/x11/ipc/server/ocopserver.cpp
index 4940cb8..0f818b7 100644
--- a/x11/ipc/server/ocopserver.cpp
+++ b/x11/ipc/server/ocopserver.cpp
@@ -166,3 +166,3 @@ void OCopServer::newOnClient( int fd ) {
if (head.magic == 47 ) {
- qWarning("magic match");
+// qWarning("magic match");
QCString channel( head.chlen+1 );
@@ -174,3 +174,3 @@ void OCopServer::newOnClient( int fd ) {
*/
- qWarning("read ");
+// qWarning("read ");
int s = read(fd, channel.data(), head.chlen );
@@ -178,7 +178,7 @@ void OCopServer::newOnClient( int fd ) {
s = read(fd, data.data(), head.datalen );
- qWarning("read");
+// qWarning("read");
/* debug output */
- qWarning("channel %s %d", channel.data(), head.chlen );
- qWarning("func %s %d", func.data(), head.funclen );
+// qWarning("channel %s %d", channel.data(), head.chlen );
+// qWarning("func %s %d", func.data(), head.funclen );
/* debug end */
@@ -216,6 +216,2 @@ void OCopServer::deregisterClient(int fd ) {
if (it != m_clients.end() ) {
- OCOPClient client = it.data();
- delete client.notify;
- m_clients.remove(fd );
- close(fd );
/*
@@ -235,3 +231,3 @@ void OCopServer::deregisterClient(int fd ) {
*/
- qWarning("Channel %s", it2.key().data() );
+ qWarning("Channel %s %d", it2.key().data(), it2.data().count() );
if ( it2.data().contains( fd ) ) {
@@ -243,3 +239,3 @@ void OCopServer::deregisterClient(int fd ) {
*/
- if ( array.count() == 1 ) {
+ if ( array.count() == 1 || array.count() == 0) {
qWarning("Invalidate!");
@@ -256,5 +252,7 @@ void OCopServer::deregisterClient(int fd ) {
}else{
- qWarning("removing");
- array.remove( fd );
- it2 = m_channels.replace( it2.key(), array );
+ qWarning("removing count %d %d",fd, array.count() );
+ QValueList<int>::Iterator it3 = array.find( fd );
+ it3 = array.remove( it3 );
+ QCString key = it2.key().copy();
+ it2 = m_channels.replace( key, array );
}
@@ -262,2 +260,6 @@ void OCopServer::deregisterClient(int fd ) {
} // off all channels
+ OCOPClient client = it.data();
+ delete client.notify;
+ m_clients.remove(fd );
+ close(fd );
}
@@ -329,7 +331,13 @@ void OCopServer::addChannel( const QCString& channel,
it = m_channels.find( channel );
-
- /* could be empty */
- QValueList<int> list = it.data();
- list.append( fd );
- it = m_channels.replace( channel, list );
+ if ( it != m_channels.end() ) {
+ /* could be empty */
+ QValueList<int> list = it.data();
+ list.append( fd );
+ qWarning("count is now in addChannel %d %s", list.count(), channel.data() );
+ it = m_channels.replace( channel, list );
+ }else {
+ QValueList<int> ints;
+ ints.append( fd );
+ m_channels.insert( channel, ints );
+ }
};
@@ -337,2 +345,3 @@ void OCopServer::delChannel( const QCString& channel,
int fd ) {
+ qWarning("remove %s, %d", channel.data(), fd );
if (!m_channels.contains( channel ) )
@@ -344,11 +353,13 @@ void OCopServer::delChannel( const QCString& channel,
if ( it.data().contains(fd) ) {
-
QValueList<int> ints = it.data();
if ( ints.count() == 1 )
- m_channels.remove( it );
+ m_channels.remove( channel );
else{
QValueList<int> ints = it.data();
- ints.remove( fd );
- m_channels.replace( it.key(), ints );
+ QValueList<int>::Iterator rem = ints.find( fd );
+ rem = ints.remove( rem );
+ QCString str = it.key().copy();
+ m_channels.replace( str, ints );
}
+ qWarning(" channel count is now %d", ints.count() );
}
@@ -356,3 +367,3 @@ void OCopServer::delChannel( const QCString& channel,
void OCopServer::isRegistered( const QCString& channel, int fd) {
- qWarning("isRegistered");
+// qWarning("isRegistered");
OCOPHead head;