| 128 | } |
| 129 | |
| 130 | bool LocalPeer::isClient() |
| 131 | { |
| 132 | if (lockFile->isLocked()) |
| 133 | return false; |
| 134 | |
| 135 | if (!lockFile->lock(LockedFile::WriteLock, false)) |
| 136 | return true; |
| 137 | |
| 138 | bool res = server->listen(socketName); |
| 139 | #if defined(Q_OS_UNIX) |
| 140 | // ### Workaround |
| 141 | if (!res && server->serverError() == QAbstractSocket::AddressInUseError) { |
| 142 | QFile::remove(QDir::cleanPath(QDir::tempPath()) + QLatin1Char('/') + socketName); |
| 143 | res = server->listen(socketName); |
| 144 | } |
| 145 | #endif |
| 146 | if (!res) |
| 147 | qWarning("QtSingleCoreApplication: listen on local socket failed, %s", qPrintable(server->errorString())); |
| 148 | QObject::connect(server.get(), SIGNAL(newConnection()), SLOT(receiveConnection())); |
| 149 | return false; |
| 150 | } |
| 151 | |
| 152 | bool LocalPeer::sendMessage(const QByteArray& message, int timeout) |
| 153 | { |
no test coverage detected