| 109 | } |
| 110 | |
| 111 | bool QtLocalPeer::isClient() |
| 112 | { |
| 113 | if (lockFile.isLocked()) |
| 114 | return false; |
| 115 | |
| 116 | if (!lockFile.lock(QtLP_Private::QtLockedFile::WriteLock, false)) |
| 117 | return true; |
| 118 | |
| 119 | bool res = server->listen(socketName); |
| 120 | #if defined(Q_OS_UNIX) |
| 121 | // ### Workaround |
| 122 | if (!res && server->serverError() == QAbstractSocket::AddressInUseError) |
| 123 | { |
| 124 | QFile::remove(QDir::cleanPath(QDir::tempPath()) + QLatin1Char('/') + socketName); |
| 125 | res = server->listen(socketName); |
| 126 | } |
| 127 | #endif |
| 128 | if (!res) |
| 129 | qWarning("QtSingleCoreApplication: listen on local socket failed, %s", qPrintable(server->errorString())); |
| 130 | QObject::connect(server, SIGNAL(newConnection()), SLOT(receiveConnection())); |
| 131 | return false; |
| 132 | } |
| 133 | |
| 134 | bool QtLocalPeer::sendMessage(const QByteArray &message, int timeout) |
| 135 | { |
no test coverage detected