mirror of
https://github.com/debauchee/barrier.git
synced 2026-05-09 16:02:46 +08:00
* removed wait cond and mutex usage from gui ipc log reader (it was being used incorrectly anyway)
* raised the log-to-console level to DEBUG2 * added force option to ipc log buffer (to side-step the anti-recursion "mechanism") * made relauncher always relay server/client messages to ipc client (gui)
This commit is contained in:
@@ -22,7 +22,8 @@
|
||||
#include <QMutex>
|
||||
|
||||
IpcReader::IpcReader(QTcpSocket* socket) :
|
||||
m_Socket(socket)
|
||||
m_Socket(socket),
|
||||
m_ReadyRead(false)
|
||||
{
|
||||
connect(socket, SIGNAL(readyRead()), this, SLOT(readyRead()));
|
||||
}
|
||||
@@ -34,7 +35,7 @@ IpcReader::~IpcReader()
|
||||
void IpcReader::readyRead()
|
||||
{
|
||||
std::cout << "ready read" << std::endl;
|
||||
m_Ready.wakeAll();
|
||||
m_ReadyRead = true;
|
||||
}
|
||||
|
||||
void IpcReader::run()
|
||||
@@ -60,7 +61,7 @@ void IpcReader::run()
|
||||
}
|
||||
|
||||
default:
|
||||
std::cerr << "aborting, message invalid: " << codeBuf[0] << std::endl;
|
||||
std::cerr << "aborting, message invalid: " << (unsigned int)codeBuf[0] << std::endl;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -68,9 +69,6 @@ void IpcReader::run()
|
||||
|
||||
void IpcReader::readStream(char* buffer, int length)
|
||||
{
|
||||
QMutex mutex;
|
||||
mutex.lock();
|
||||
|
||||
QDataStream stream(m_Socket);
|
||||
std::cout << "reading stream" << std::endl;
|
||||
|
||||
@@ -81,7 +79,14 @@ void IpcReader::readStream(char* buffer, int length)
|
||||
|
||||
if (got == 0) {
|
||||
std::cout << "end of buffer, waiting" << std::endl;
|
||||
m_Ready.wait(&mutex);
|
||||
|
||||
// i'd love nothing more than to use a wait condition here, but
|
||||
// qt is such a fucker with mutexes (can't lock/unlock between
|
||||
// threads?! wtf?!). i'd just rather not go there (patches welcome).
|
||||
while (!m_ReadyRead) {
|
||||
QThread::usleep(100);
|
||||
}
|
||||
m_ReadyRead = false;
|
||||
}
|
||||
else if (got == -1) {
|
||||
std::cout << "socket ended, aborting" << std::endl;
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <QThread>
|
||||
#include <QWaitCondition>
|
||||
|
||||
class QTcpSocket;
|
||||
|
||||
@@ -44,5 +43,5 @@ private slots:
|
||||
|
||||
private:
|
||||
QTcpSocket* m_Socket;
|
||||
QWaitCondition m_Ready;
|
||||
bool m_ReadyRead;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user