From bbb3690f12191763a407e6a0edd521113b3c25ac Mon Sep 17 00:00:00 2001 From: zecke Date: Wed, 05 Feb 2003 08:54:58 +0000 Subject: Fix the IPC server and client registering channel is done locally with refcounts if the channel is already registered globally Fix some sizes to allow proper communication.. --- (limited to 'x11/ipc') diff --git a/x11/ipc/client/ocopclient.cpp b/x11/ipc/client/ocopclient.cpp index 6085481..91827e7 100644 --- a/x11/ipc/client/ocopclient.cpp +++ b/x11/ipc/client/ocopclient.cpp @@ -99,9 +99,14 @@ OCOPPacket OCOPClient::packet() const{ memset(&head, 0, sizeof(head) ); read(m_socket, &head, sizeof(head) ); if ( head.magic == 47 ) { + qWarning("Client:Magic Match"); + chan = QCString( head.chlen+1); + func = QCString( head.funclen+1 ); + ar = QByteArray( head.datalen); read(m_socket, chan.data(), head.chlen ); read(m_socket, func.data(), head.funclen ); read(m_socket, ar.data(), head.datalen ); + qWarning("Client:%d %s",head.chlen,chan.data() ); } OCOPPacket pack(head.type, chan, func, ar ); return pack; @@ -112,6 +117,7 @@ OCOPPacket OCOPClient::packet() const{ * this will be blocked */ bool OCOPClient::isRegistered( const QCString& chan ) const{ + qWarning("OCopClient::isRegistered %s", chan.data() ); /* should I disconnect the socket notfier? */ OCOPPacket packe(OCOPPacket::IsRegistered, chan ); OCOPHead head = packe.head(); @@ -119,6 +125,7 @@ bool OCOPClient::isRegistered( const QCString& chan ) const{ write(m_socket, chan.data(), chan.size() ); /* block */ OCOPPacket pack = packet(); + qWarning("unblock %s %s", pack.channel().data(), chan.data() ); /* connect here again */ if ( pack.channel() == chan ) { @@ -130,6 +137,7 @@ bool OCOPClient::isRegistered( const QCString& chan ) const{ return false; }; void OCOPClient::send( const QCString& chan, const QCString& fu, const QByteArray& arr ) { + qWarning("ClientSending %s %s", chan.data(), fu.data() ); OCOPPacket pack(OCOPPacket::Call, chan, fu, arr ); call( pack ); } diff --git a/x11/ipc/server/ocopserver.cpp b/x11/ipc/server/ocopserver.cpp index 0f818b7..ee5ea18 100644 --- a/x11/ipc/server/ocopserver.cpp +++ b/x11/ipc/server/ocopserver.cpp @@ -167,7 +167,7 @@ void OCopServer::newOnClient( int fd ) { // qWarning("magic match"); QCString channel( head.chlen+1 ); QCString func( head.funclen+1 ); - QByteArray data ( head.datalen ); + QByteArray data ( head.datalen+1 ); /* * we do not check for errors @@ -300,7 +300,7 @@ void OCopServer::dispatch( const OCOPPacket& packet, int sourceFD ) { case OCOPPacket::Signal: break; case OCOPPacket::IsRegistered: - qWarning("IsRegistered"); + qWarning("Server:IsRegistered %s", packet.channel().data() ); isRegistered( packet.channel(), sourceFD ); break; }; @@ -365,7 +365,7 @@ void OCopServer::delChannel( const QCString& channel, } } void OCopServer::isRegistered( const QCString& channel, int fd) { -// qWarning("isRegistered"); + qWarning("Server:isRegistered %s", channel.data() ); OCOPHead head; QCString func(2); @@ -379,8 +379,10 @@ void OCopServer::isRegistered( const QCString& channel, int fd) { if ( isChannelRegistered( channel ) ) { //is registered func[0] = 1; + qWarning("Server:Channel is Registered %d", head.chlen); }else{ func[0] = 0; + qWarning("Server:Channel is NotRegistered"); } /** @@ -401,6 +403,7 @@ void OCopServer::call( const OCOPPacket& p, int ) { OCOPHead head = p.head(); for (it = cli.begin(); it != cli.end(); ++it ) { + qWarning("Server:calling %d %s %s", (*it), p.channel().data(), p.header().data() ); write( (*it), &head, sizeof(head ) ); /* expl. shared! */ write( (*it), p.channel().data(), p.channel().size() ); -- cgit v0.9.0.2