mirror of
https://github.com/hyprwm/Hyprland
synced 2025-02-18 12:42:13 +01:00
hyprctl: make recv timeout bigger and give error message if it does timeout (#6621)
This commit is contained in:
parent
fa022901cf
commit
4778afe2e6
1 changed files with 3 additions and 1 deletions
|
@ -141,7 +141,7 @@ int rollingRead(const int socket) {
|
||||||
int request(std::string arg, int minArgs = 0, bool needRoll = false) {
|
int request(std::string arg, int minArgs = 0, bool needRoll = false) {
|
||||||
const auto SERVERSOCKET = socket(AF_UNIX, SOCK_STREAM, 0);
|
const auto SERVERSOCKET = socket(AF_UNIX, SOCK_STREAM, 0);
|
||||||
|
|
||||||
auto t = timeval{.tv_sec = 0, .tv_usec = 100000};
|
auto t = timeval{.tv_sec = 1, .tv_usec = 0};
|
||||||
setsockopt(SERVERSOCKET, SOL_SOCKET, SO_RCVTIMEO, &t, sizeof(struct timeval));
|
setsockopt(SERVERSOCKET, SOL_SOCKET, SO_RCVTIMEO, &t, sizeof(struct timeval));
|
||||||
|
|
||||||
const auto ARGS = std::count(arg.begin(), arg.end(), ' ');
|
const auto ARGS = std::count(arg.begin(), arg.end(), ' ');
|
||||||
|
@ -191,6 +191,8 @@ int request(std::string arg, int minArgs = 0, bool needRoll = false) {
|
||||||
sizeWritten = read(SERVERSOCKET, buffer, 8192);
|
sizeWritten = read(SERVERSOCKET, buffer, 8192);
|
||||||
|
|
||||||
if (sizeWritten < 0) {
|
if (sizeWritten < 0) {
|
||||||
|
if (errno == EWOULDBLOCK)
|
||||||
|
log("Hyprland IPC didn't respond in time\n");
|
||||||
log("Couldn't read (5)");
|
log("Couldn't read (5)");
|
||||||
return 5;
|
return 5;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue