Hi Matt,
i found a little problem playing with qjsonrpc.
My service/server expose a "stop" method that should close the server application itself.
When the stop() method is invoked by the client I emit a queued signal ( Qt::QueuedConnection ) to a method (in the same object) that
should stop and close the service; something like this:
if (tcpServer->isListening()) {
tcpServer->removeService(service);
tcpServer->close();
}
delete tcpServer;
The QueuedConnection (instead of default DirectConnection) avoids delete of the service/server object before the stop() method returns a value to the client.
In fact in the log messages I can see the reply sent from the server
received( QJsonRpcSocket(0x4b2278) ): "{"id":30,"jsonrpc":"2.0","method":"component.stop","params":[4]}"
....
sending( QJsonRpcSocket(0x4b2278) ): "{"id":30,"jsonrpc":"2.0","result":0}"
Unfortunatelly the client never receive this response, and this produces a lock in my code.
I suspect that the close() /delete are executed before the reply is transmitted through the socket (but after the writeData on socket,
as the log message says). In this case I usually put a flush() of the socket before closing it (I suppose this could fix the problem), but I'm not able
to access the client's sockets with qjsonrpc lib.
What do you think about? Any idea?
best regards
Marco