Commit 0d5ee6b2 authored by jan.koester's avatar jan.koester
Browse files

test

parent 32e90bce
Loading
Loading
Loading
Loading
+4 −1
Changes for src/sysbus/client.cpp: 4 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -470,6 +470,7 @@ bool Client::subscribe() {

bool Client::waitSignal(Message &out, int timeoutMs) {
    long deadline = timeoutMs < 0 ? 0 : nowMs() + timeoutMs;
    bool looked = false;
    for (;;) {
        if (!_pendingSignals.empty()) {
            out = std::move(_pendingSignals.front());
@@ -489,10 +490,12 @@ bool Client::waitSignal(Message &out, int timeoutMs) {
        if (_fd < 0 || _decoder.failed()) return false;
        int wait = -1;
        if (timeoutMs >= 0) {
            // timeoutMs 0: one look at the socket (what poll() said is there)
            long left = deadline - nowMs();
            if (left <= 0) return false;
            if (left < 0 || (left == 0 && looked)) return false;
            wait = static_cast<int>(left);
        }
        looked = true;
        if (!readSome(wait)) return false;
    }
}