author | zecke <zecke> | 2002-10-16 16:53:43 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-10-16 16:53:43 (UTC) |
commit | ef5700ad4eda47e98b76467fa80dd6cd838c6391 (patch) (unidiff) | |
tree | dcd5d051824689cab42f036895959483fb5e690b /x11/ipc/client/ocopclient.cpp | |
parent | ea11ae7dc31e23578d13f30315a3697cbce99c05 (diff) | |
download | opie-ef5700ad4eda47e98b76467fa80dd6cd838c6391.zip opie-ef5700ad4eda47e98b76467fa80dd6cd838c6391.tar.gz opie-ef5700ad4eda47e98b76467fa80dd6cd838c6391.tar.bz2 |
some debug output
+ bugfix
besides some problems with the server IPC is working on X11
too
Diffstat (limited to 'x11/ipc/client/ocopclient.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | x11/ipc/client/ocopclient.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/x11/ipc/client/ocopclient.cpp b/x11/ipc/client/ocopclient.cpp index ac6e4a3..c1def73 100644 --- a/x11/ipc/client/ocopclient.cpp +++ b/x11/ipc/client/ocopclient.cpp | |||
@@ -62,89 +62,89 @@ void OCOPClient::init( const QCString& ) { | |||
62 | */ | 62 | */ |
63 | void OCOPClient::newData() { | 63 | void OCOPClient::newData() { |
64 | OCOPPacket pack = packet(); | 64 | OCOPPacket pack = packet(); |
65 | if ( pack.channel().isEmpty() ) | 65 | if ( pack.channel().isEmpty() ) |
66 | return; | 66 | return; |
67 | 67 | ||
68 | switch( pack.type() ) { | 68 | switch( pack.type() ) { |
69 | case OCOPPacket::Register: | 69 | case OCOPPacket::Register: |
70 | case OCOPPacket::Unregister: | 70 | case OCOPPacket::Unregister: |
71 | case OCOPPacket::Method: | 71 | case OCOPPacket::Method: |
72 | case OCOPPacket::RegisterChannel: | 72 | case OCOPPacket::RegisterChannel: |
73 | case OCOPPacket::UnregisterChannel: | 73 | case OCOPPacket::UnregisterChannel: |
74 | case OCOPPacket::Return: | 74 | case OCOPPacket::Return: |
75 | case OCOPPacket::Signal: | 75 | case OCOPPacket::Signal: |
76 | /* is Registered should be handled sync */ | 76 | /* is Registered should be handled sync */ |
77 | case OCOPPacket::IsRegistered: | 77 | case OCOPPacket::IsRegistered: |
78 | break; | 78 | break; |
79 | /* emit the signal */ | 79 | /* emit the signal */ |
80 | case OCOPPacket::Call: | 80 | case OCOPPacket::Call: |
81 | emit called( pack.channel(), pack.header(), pack.content() ); | 81 | emit called( pack.channel(), pack.header(), pack.content() ); |
82 | break; | 82 | break; |
83 | } | 83 | } |
84 | } | 84 | } |
85 | OCOPPacket OCOPClient::packet() const{ | 85 | OCOPPacket OCOPClient::packet() const{ |
86 | QCString chan; | 86 | QCString chan; |
87 | QCString func; | 87 | QCString func; |
88 | QByteArray ar; | 88 | QByteArray ar; |
89 | OCOPHead head; | 89 | OCOPHead head; |
90 | memset(&head, 0, sizeof(head) ); | 90 | memset(&head, 0, sizeof(head) ); |
91 | read(m_socket, &head, sizeof(head) ); | 91 | read(m_socket, &head, sizeof(head) ); |
92 | if ( head.magic == 47 ) { | 92 | if ( head.magic == 47 ) { |
93 | read(m_socket, chan.data(), head.chlen ); | 93 | read(m_socket, chan.data(), head.chlen ); |
94 | read(m_socket, func.data(), head.funclen ); | 94 | read(m_socket, func.data(), head.funclen ); |
95 | read(m_socket, ar.data(), head.datalen ); | 95 | read(m_socket, ar.data(), head.datalen ); |
96 | } | 96 | } |
97 | OCOPPacket pack(head.type, chan, func, ar ); | 97 | OCOPPacket pack(head.type, chan, func, ar ); |
98 | return pack; | 98 | return pack; |
99 | } | 99 | } |
100 | /* | 100 | /* |
101 | * we've blocking IO here on these sockets | 101 | * we've blocking IO here on these sockets |
102 | * so we send and go on read | 102 | * so we send and go on read |
103 | * this will be blocked | 103 | * this will be blocked |
104 | */ | 104 | */ |
105 | bool OCOPClient::isRegistered( const QCString& chan ) const{ | 105 | bool OCOPClient::isRegistered( const QCString& chan ) const{ |
106 | /* should I disconnect the socket notfier? */ | 106 | /* should I disconnect the socket notfier? */ |
107 | OCOPPacket packe(OCOPPacket::IsRegistered, chan ); | 107 | OCOPPacket packe(OCOPPacket::IsRegistered, chan ); |
108 | OCOPHead head = packe.head(); | 108 | OCOPHead head = packe.head(); |
109 | write(m_socket, &head, sizeof(head) ); | 109 | write(m_socket, &head, sizeof(head) ); |
110 | 110 | write(m_socket, chan.data(), chan.size() ); | |
111 | /* block */ | 111 | /* block */ |
112 | OCOPPacket pack = packet(); | 112 | OCOPPacket pack = packet(); |
113 | 113 | ||
114 | /* connect here again */ | 114 | /* connect here again */ |
115 | if ( pack.channel() == chan ) { | 115 | if ( pack.channel() == chan ) { |
116 | QCString func = pack.header(); | 116 | QCString func = pack.header(); |
117 | if (func[0] == 1 ) | 117 | if (func[0] == 1 ) |
118 | return true; | 118 | return true; |
119 | } | 119 | } |
120 | 120 | ||
121 | return false; | 121 | return false; |
122 | }; | 122 | }; |
123 | void OCOPClient::send( const QCString& chan, const QCString& fu, const QByteArray& arr ) { | 123 | void OCOPClient::send( const QCString& chan, const QCString& fu, const QByteArray& arr ) { |
124 | OCOPPacket pack(OCOPPacket::Call, chan, fu, arr ); | 124 | OCOPPacket pack(OCOPPacket::Call, chan, fu, arr ); |
125 | call( pack ); | 125 | call( pack ); |
126 | } | 126 | } |
127 | void OCOPClient::addChannel(const QCString& channel) { | 127 | void OCOPClient::addChannel(const QCString& channel) { |
128 | OCOPPacket pack(OCOPPacket::RegisterChannel, channel ); | 128 | OCOPPacket pack(OCOPPacket::RegisterChannel, channel ); |
129 | call( pack ); | 129 | call( pack ); |
130 | } | 130 | } |
131 | void OCOPClient::delChannel(const QCString& chan ) { | 131 | void OCOPClient::delChannel(const QCString& chan ) { |
132 | OCOPPacket pack(OCOPPacket::UnregisterChannel, chan ); | 132 | OCOPPacket pack(OCOPPacket::UnregisterChannel, chan ); |
133 | call( pack ); | 133 | call( pack ); |
134 | } | 134 | } |
135 | void OCOPClient::call( const OCOPPacket& pack ) { | 135 | void OCOPClient::call( const OCOPPacket& pack ) { |
136 | OCOPHead head = pack.head(); | 136 | OCOPHead head = pack.head(); |
137 | write(m_socket, &head, sizeof(head) ); | 137 | write(m_socket, &head, sizeof(head) ); |
138 | write(m_socket, pack.channel().data(), pack.channel().size() ); | 138 | write(m_socket, pack.channel().data(), pack.channel().size() ); |
139 | write(m_socket, pack.header().data(), pack.header().size() ); | 139 | write(m_socket, pack.header().data(), pack.header().size() ); |
140 | write(m_socket, pack.content().data(), pack.content().size() ); | 140 | write(m_socket, pack.content().data(), pack.content().size() ); |
141 | } | 141 | } |
142 | void OCOPClient::startUP() { | 142 | void OCOPClient::startUP() { |
143 | qWarning("Start me up"); | 143 | qWarning("Start me up"); |
144 | pid_t pi = fork(); | 144 | pid_t pi = fork(); |
145 | if ( pi == 0 ) { | 145 | if ( pi == 0 ) { |
146 | setsid(); | 146 | setsid(); |
147 | execlp("opie-ipc", "opie-ipc", NULL ); | 147 | execlp("ocopserver", "ocopserver", NULL ); |
148 | _exit(1); | 148 | _exit(1); |
149 | } | 149 | } |
150 | } | 150 | } |