mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-25 07:29:33 -05:00
Merge pull request #1678 from defnax/fix-retroshare-ipc
Fix retroshare ipc
This commit is contained in:
commit
66d31d7629
@ -241,6 +241,11 @@ Rshare::Rshare(QStringList args, int &argc, char **argv, const QString &dir)
|
||||
localServer= new QLocalServer();
|
||||
QObject::connect(localServer, SIGNAL(newConnection()), this, SLOT(slotConnectionEstablished()));
|
||||
updateLocalServer();
|
||||
// clear out any old arguments (race condition?)
|
||||
QSharedMemory newArgs;
|
||||
newArgs.setKey(QString(TARGET) + "_newArgs");
|
||||
if(newArgs.attach(QSharedMemory::ReadWrite))
|
||||
newArgs.detach();
|
||||
}
|
||||
}
|
||||
|
||||
@ -325,20 +330,27 @@ Rshare::~Rshare()
|
||||
*/
|
||||
void Rshare::slotConnectionEstablished()
|
||||
{
|
||||
QLocalSocket *socket = localServer->nextPendingConnection();
|
||||
socket->close();
|
||||
delete socket;
|
||||
|
||||
QSharedMemory newArgs;
|
||||
newArgs.setKey(QString(TARGET) + "_newArgs");
|
||||
|
||||
QLocalSocket *socket = localServer->nextPendingConnection();
|
||||
|
||||
if (!newArgs.attach())
|
||||
{
|
||||
/* this is not an error. It just means we were notified to check
|
||||
newArgs, but none had been set yet.
|
||||
TODO: implement separate ping/take messages
|
||||
std::cerr << "(EE) Rshare::slotConnectionEstablished() Unable to attach to shared memory segment."
|
||||
<< newArgs.errorString().toStdString() << std::endl;
|
||||
*/
|
||||
socket->close();
|
||||
delete socket;
|
||||
return;
|
||||
}
|
||||
|
||||
socket->close();
|
||||
delete socket;
|
||||
|
||||
QBuffer buffer;
|
||||
QDataStream in(&buffer);
|
||||
QStringList args;
|
||||
|
Loading…
Reference in New Issue
Block a user