diff options
author | Michael Brasser <mbrasser@ford.com> | 2018-04-18 16:26:25 -0500 |
---|---|---|
committer | Michael Brasser <michael.brasser@live.com> | 2018-04-18 21:48:43 +0000 |
commit | 1135417853d83545a85dc2d283df388205a3609a (patch) | |
tree | 92fb176f3594a0b96ae0616a6115e261e559b24d | |
parent | 556539365ab1eeaab339fc527c4c2130c2f804ff (diff) |
Improve "qnx" backend
* Initialize HAM variables
* Don't continue to create channels if one already exists
* Fix parenting of QIOQnxSource to prevent parent thread warnings
* Fix terminate pulse to prevent qFatal on success
Change-Id: I3d8019b3f3b9e21c8ae97232b110ea28fcdcd63f
Reviewed-by: Brett Stottlemyer <bstottle@ford.com>
-rw-r--r-- | src/remoteobjects/qconnection_qnx_qiodevices.cpp | 17 | ||||
-rw-r--r-- | src/remoteobjects/qconnection_qnx_server.cpp | 3 | ||||
-rw-r--r-- | src/remoteobjects/qconnection_qnx_server_p.h | 3 |
3 files changed, 14 insertions, 9 deletions
diff --git a/src/remoteobjects/qconnection_qnx_qiodevices.cpp b/src/remoteobjects/qconnection_qnx_qiodevices.cpp index 2108b86..b12cb7d 100644 --- a/src/remoteobjects/qconnection_qnx_qiodevices.cpp +++ b/src/remoteobjects/qconnection_qnx_qiodevices.cpp @@ -67,14 +67,16 @@ bool QQnxNativeIoPrivate::establishConnection() { //On the client side, we need to create the channel/connection //to listen for the server's send pulse. - const int channel = ChannelCreate(0); - if (channel == -1) { - WARNING(ChannelCreate) - return false; + if (channelId == -1) { + const int channel = ChannelCreate(0); + if (channel == -1) { + WARNING(ChannelCreate) + return false; + } + channelId = channel; } - channelId = channel; - const int connection = ConnectAttach(ND_LOCAL_NODE, 0, channel, _NTO_SIDE_CHANNEL, 0); + const int connection = ConnectAttach(ND_LOCAL_NODE, 0, channelId, _NTO_SIDE_CHANNEL, 0); if (connection == -1) { WARNING(ConnectAttach) teardownConnection(); @@ -149,10 +151,11 @@ void QQnxNativeIoPrivate::stopThread() } qFatal("MsgSendPulse failed on terminate pulse. Error = %s", strerror(errno)); } + thread.wait(); + return; } if (errno == EAGAIN) qFatal("MsgSendPulse failed on terminate pulse (max retries)"); - thread.wait(); } } diff --git a/src/remoteobjects/qconnection_qnx_server.cpp b/src/remoteobjects/qconnection_qnx_server.cpp index dcbfe0f..34e1959 100644 --- a/src/remoteobjects/qconnection_qnx_server.cpp +++ b/src/remoteobjects/qconnection_qnx_server.cpp @@ -440,8 +440,9 @@ void QQnxNativeServerPrivate::teardownServer() void QQnxNativeServerPrivate::createSource(int rcvid, uint64_t uid, pid_t toPid) { Q_Q(QQnxNativeServer); - QIOQnxSource *io = new QIOQnxSource(rcvid, q); + QIOQnxSource *io = new QIOQnxSource(rcvid); io->moveToThread(q->thread()); + io->setParent(q); QObject::connect(io, &QIOQnxSource::aboutToClose, q, &QQnxNativeServer::onSourceClosed); diff --git a/src/remoteobjects/qconnection_qnx_server_p.h b/src/remoteobjects/qconnection_qnx_server_p.h index 682a2b2..8f0be3b 100644 --- a/src/remoteobjects/qconnection_qnx_server_p.h +++ b/src/remoteobjects/qconnection_qnx_server_p.h @@ -103,7 +103,8 @@ public: ham_entity_t *hamEntityHandle; ham_condition_t *hamConditionHandle; QHash<uint64_t, ham_action_t*> hamActions; - bool hamAvailable, hamInitialized; + bool hamAvailable = false; + bool hamInitialized = false; #endif }; |