Skip to content

Keep a slow-looking network in the game (seed weight floor 0.5) - #2

Open
rohit267 wants to merge 2 commits into
mainfrom
fix/seed-weight-floor
Open

rohit267 wants to merge 2 commits into
mainfrom
fix/seed-weight-floor

Conversation

@rohit267

@rohit267 rohit267 commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Fixes the "mobile data is not used with Wi-Fi" reports (net-merge/net-merge#69, #70).

Cause. The engine starts each network's weight from the speed Android reports for it (Wi-Fi 6 can claim 1 Gbit/s while mobile data claims 145 Mbit/s), and keeps that weight until every network has been measured. The network that looks slower gets no new connections until the other one is busy, so it is never measured and stays unused. The old floor was 0.1.

Change. The floor is now 0.5: a network always gets at least one new connection in three until it has been measured. After that the measured speeds take over, as before. Two files in golib/netmerge: the constant, and tests.

Tests.

  • New Go test TestSlowLookingNetworkStillGetsFlows: 6 connections with Wi-Fi at 900 Mbit/s and mobile at 30 Mbit/s. It fails with the old floor (all 6 on Wi-Fi) and passes now. TestSystemEstimateSeedsWeights is updated for the new floor.
  • Emulator (Pixel_9a, Android 16), with a test-only build where Wi-Fi claims 1 Gbit/s and mobile 145 Mbit/s. Share of traffic with N parallel downloads:
Downloads Before: Wi-Fi / mobile After: Wi-Fi / mobile
1 100% / 0% 100% / 0% (one connection uses one network)
3 100% / 0% 20% / 79%
6 24% / 75% 8% / 91%
12 14% / 85% 24% / 75%
24 10% / 89% 13% / 89%

Known cost: a network that is really very slow (under about 0.4 Mbit/s, so it never counts as measured) keeps getting one connection in three. That is rare and the probe still sidelines a network with no internet.

Not related to the open PR #1: that change does not fix this (tested on two emulators; it also stops late-enabled mobile data from joining).

🤖 Generated with Claude Code

rohit267 and others added 2 commits November 3, 2026 00:09
The engine starts each network's weight from the speed Android reports,
and keeps it until every network has been measured. With a floor of 0.1 a
network the system rates slower (Wi-Fi 6 link speed against 4G, for example)
gets no new connections until the other has ten open, so it is never
measured and the app shows mobile data or Wi-Fi unused. A floor of 0.5
gives it at least one connection in three, so it carries traffic and is
measured, after which the measured speeds take over.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
A store update or a download manager opens a few connections to one
server. They were placed by the global open-flow count, which other apps'
idle connections make arbitrary, so the parts landed on one network or
the other at random and "Split evenly" changed nothing.

A new connection to a server that already has open connections now goes
to the network with the fewest of them. Speed weights still count, loosely:
none counts for less than half of the fastest, and a network clearly
slower than a fifth of the fastest is left out. The first connection to a
server is placed as before.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant