mirror of
https://git.outfoxxed.me/quickshell/quickshell.git
synced 2026-04-10 06:11:54 +10:00
all: retry incomplete socket reads
Fixes greetd and hyprland ipc sockets reads being incomplete and breaking said integrations on slow machines.
This commit is contained in:
parent
cf1a2aeb2d
commit
bd62179277
13 changed files with 221 additions and 103 deletions
26
src/core/streamreader.hpp
Normal file
26
src/core/streamreader.hpp
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
#pragma once
|
||||
|
||||
#include <qbytearray.h>
|
||||
#include <qiodevice.h>
|
||||
#include <qtypes.h>
|
||||
|
||||
class StreamReader {
|
||||
public:
|
||||
void setDevice(QIODevice* device);
|
||||
|
||||
void startTransaction();
|
||||
QByteArray readBytes(qsizetype count);
|
||||
QByteArray readUntil(char terminator);
|
||||
void readInto(char* ptr, qsizetype count);
|
||||
qint32 readI32();
|
||||
bool commitTransaction();
|
||||
void reset();
|
||||
|
||||
private:
|
||||
bool fill();
|
||||
|
||||
QIODevice* device = nullptr;
|
||||
QByteArray buffer;
|
||||
qsizetype cursor = 0;
|
||||
bool failed = false;
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue