MCPcopy Create free account
hub / github.com/CE-Programming/CEmu / ipcSetup

Method ipcSetup

gui/qt/ipc.cpp:87–129  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

85}
86
87bool InterCom::ipcSetup(const QString &id, const QString &pid) {
88 bool ret = true;
89
90 // find the default configuration path
91 QString idPath = configPath + QStringLiteral("/id/");
92 QString idFile = idPath + id;
93
94 QDir config;
95 config.mkpath(idPath);
96
97 m_file.setFileName(idFile);
98 if (m_file.exists()) {
99 // send to alternate id
100 if (m_file.open(QIODevice::ReadOnly)) {
101 QTextStream stream(&m_file);
102 QString pidtest = stream.readLine();
103 if (!isProcRunning(static_cast<pid_t>(pidtest.toLongLong()))) {
104 m_file.close();
105 m_file.remove();
106 goto create_id;
107 }
108 clientSetup(pidtest);
109 ret = false;
110 }
111 } else {
112 // create a local id
113create_id:
114 if (m_file.open(QIODevice::WriteOnly)) {
115 QTextStream stream(&m_file);
116 stream << pid <<
117#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
118 Qt::endl;
119#else
120 endl;
121#endif
122
123 serverSetup(pid);
124 serverListen();
125 }
126 }
127 m_file.close();
128 return ret;
129}

Callers

nothing calls this directly

Calls 1

isProcRunningFunction · 0.85

Tested by

no test coverage detected