https://bugs.kde.org/show_bug.cgi?id=514395

--- Comment #1 from Jonathan Verner <[email protected]> ---
I've changed the `updateWindowSize` method as follows:

```cpp
    if (scaled_gain >= static_cast<double>(std::numeric_limits<int>::max())) {
        max_window = 5000 + 1;
        Out(SYS_UTP|LOG_DEBUG) << "RemoteWindow::updateWindowSize: scaled_gain
too big: " << scaled_gain << " " << max_window << endl;
    } else if (scaled_gain <=
static_cast<double>(std::numeric_limits<int>::min())) {
        max_window = MIN_PACKET_SIZE;
        Out(SYS_UTP|LOG_DEBUG) << "RemoteWindow::updateWindowSize: scaled_gain
too small: " << scaled_gain << " " << max_window << endl;
    } else {
        int d = (int)qRound(scaled_gain);
        if (max_window + d < MIN_PACKET_SIZE)
            max_window = MIN_PACKET_SIZE;
        else
            max_window += d;
    }
```

And now it seems to run fine. However, the above change just avoids the assert 
(note that I've encountered a scaled_gain too large *and* too small). I don't
quite 
understand the code, so I am not sure what to do if `scaled_gain` is outside of
the valid range.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to