I need call QSslSocket into grpc method (https://www.grpc.io/docs/languages/cpp/):
class GreeterServiceImpl final : public Greeter::Service {
Status SayHello(ServerContext* context, const HelloRequest* request, HelloReply* reply) override {
mySslClient.setHostName(/*...*/);
// ...
return Status::OK;
}
MySslClient mySslClient;
};
class GreeterServiceImpl final : public Greeter::Service {
Status SayHello(ServerContext* context, const HelloRequest* request, HelloReply* reply) override {
mySslClient.setHostName(/*...*/);
// ...
return Status::OK;
}
MySslClient mySslClient;
};
To copy to clipboard, switch view to plain text mode
MySslClient looks like that:
MySslClient
::MySslClient(QObject *parent
) : mSocket(new QSslSocket(this))
{
QSslConfiguration config = mSocket->sslConfiguration();
//...
MySslClient::MySslClient(QObject *parent) :
QObject(parent),
mSocket(new QSslSocket(this))
{
QSslConfiguration config = mSocket->sslConfiguration();
//...
To copy to clipboard, switch view to plain text mode
As a result, I get an error
QObject: Cannot create children
for a parent that is in a different thread.
(Parent is QSslSocket(0x55f14d7adf60), parent's thread is QThread(0x55f14d7ad700), current thread is QThread(0x7fc3fc3faf60)
QObject: Cannot create children for a parent that is in a different thread.
(Parent is QSslSocket(0x55f14d7adf60), parent's thread is QThread(0x55f14d7ad700), current thread is QThread(0x7fc3fc3faf60)
To copy to clipboard, switch view to plain text mode
Can this problem be resolved?
Bookmarks