MCPcopy Create free account
hub / github.com/PolyMC/PolyMC / isClient

Method isClient

libraries/LocalPeer/src/LocalPeer.cpp:136–156  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 2

ApplicationMethod · 0.80
installUpdatesMethod · 0.80

Calls 4

isLockedMethod · 0.80
listenMethod · 0.80
lockMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected