feat(shared): expose live upload activity for shared files over EC (#466) - #473
Merged
got3nks merged 1 commit intoJul 13, 2026
Merged
Conversation
…mule-project#466) The Shared Files view could only show static counters (transferred, requests, accepts, complete sources) — unlike Downloads, there was no way to tell an actively-seeded file from an idle one. Surface per-file upload activity over EC so clients (the REST API now, the desktop GUI later) can add the corresponding columns. Core (CKnownFile): * GetUploadDatarate() / GetTransferringClientCount() — live, summed from m_ClientUploadList: current upload speed and peers uploading now. * m_lastUploadDatetime — stamped in CFileStatistic::AddTransferred (the single point where sent bytes are attributed to a file), the upload-side analogue of the download's m_lastDateChanged. * m_dateShared — stamped once when a file completes (CompleteFileEnded) or is first hashed into the share (CKnownFileList::Append, afterHashing). Both persist in known.met as new FT_ tags (FT_LASTUPLOADED / FT_SHAREDSINCE); absent on a pre-feature known.met => 0 (unknown). Uploading never rewrites the shared file, so the timestamp can't ride the .met date the way downloads do — it needs its own tag. The unknown-tag preserve-and-rewrite path keeps this forward/backward compatible. EC / dirty-marking: * New tags EC_TAG_KNOWNFILE_UPLOAD_SPEED / _UPLOADING_COUNT / _LAST_UPLOAD (live, emitted before the UPDATE early-return) and _SHARED_SINCE (full detail). * SetUploadState marks the file EC-dirty on US_UPLOADING transitions so a file that stops uploading but stays queued drops its speed to 0 — completed/shared files have no per-tick Process() sweep like downloads. REST + SSE (amuleapi): * /shared list + detail gain upload_speed_bps, uploading, last_upload, shared_since; the SSE shared_added/shared_updated payload and EqualShared comparator carry them so live changes emit events. Tests: RefresherTest decodes the new tags; curl 04 asserts the fields. Docs: docs/api/REFERENCE.md.
got3nks
force-pushed
the
feat/shared-upload-activity-466
branch
from
July 13, 2026 14:50
d38f937 to
614634b
Compare
got3nks
pushed a commit
that referenced
this pull request
Jul 31, 2026
This is a deliberate UI change, not a behaviour-preserving refactor -- worth being explicit about per review discussion on #675. None of the 74 sites touched here have ever rendered their border: the legacy `Add(window, proportion, flag, border)` form only applies `border` when `flag` carries a direction bit (wxALL/wxLEFT/wxRIGHT/wxTOP/ wxBOTTOM), and all 74 omitted it. Converting to wxSizerFlags() and supplying a real direction bit means these borders render for the first time, which will reflow the affected dialogs to some degree. Per #663 (the case that originally surfaced this pattern): the recorded border values were never validated by anything, since they never rendered. Each site was judged against its structural siblings rather than ported verbatim -- where siblings already carried a working border, matched to it; where a site was the outlier in an otherwise-consistent row/grid, adjusted to match rather than introducing a new, never-tested value. A few sites lost their border entirely where every sibling in the same row already had none (the stray value read as leftover noise, not an intended margin). Three additional non-legacy-syntax inconsistencies folded into the same pass (found while scoping #675, confirmed still present): - PreferencesRemoteControlsTab: "Low rights password" carried Border(wxLEFT|wxRIGHT, 20) while every other same-column label in the grid ("Web template", "Full rights password") uses Border(wxRIGHT, 5) -- the 20px left indent looked like it was copy-pasted from the unrelated UPnP-port row's indent, not a deliberate choice for this row. - PreferencesOnlineSigTab: the "Save online signature file in" path field had no Expand()/proportion despite sitting in a column its parent FlexGridSizer marks growable -- it couldn't actually grow to fill the space reserved for it. - PreferencesGeneralTab: the "Browser Selection" row (text field + Browse button) still used the legacy 3-arg Add() form while the structurally identical "Video Player" row already used wxSizerFlags() -- modernized for consistency, no behaviour change (both used border 0). Scope: src/muuli_wdr.cpp only, matching where #663/#473 originally established (and didn't fully carry through) the wxSizerFlags() convention. Testing: full build verified (macOS). Visually walked every dialog these 20 functions produce that's reachable without live server/ download/client data in a fresh test config: main status bar, search, transfer panes, shared-files header, servers/Kad tabs, Friends/Messages panels, and all 15 Preferences tabs -- no clipped or overlapping controls, and the two directly-testable fixes (the OnlineSig path field now expanding, the RemoteControls password grid column now aligned) confirmed visually. NOT independently verified: fileDetails, clientDetails, commentLstDlg, and CategoriesEditWindow all require live downloads/shared files/ clients/categories to reach via the UI, which a from-scratch test config doesn't have -- these got the same siblings-based border review as everything else, but I have not seen them rendered. Sizer-border rendering is exactly where wxGTK/wxMSW/wxOSX diverge, so this needs eyes on Linux and Windows too, per the #675 review discussion.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements @ngosang's #466 — Tier 1 and Tier 2 in one PR (Tier 2 is downgrade-safe, see below). Touches the core, the EC protocol, and amuleapi.
What clients get
GET /api/v0/shared(list) and/shared/{hash}(detail) gain four fields, plus the same on the SSEshared_added/shared_updatedpayload:upload_speed_bps— the file's current combined upload rate (Σ over the peers it's uploading to).uploading— peers it's actively uploading to right now. Together withqueued_countthis gives theuploading / queuedsplit (Expose live upload activity for shared files over EC (speed, active peers, last-active time) #466 pt 3), the upload-side analogue of the Downloadstransferring / totalsources.last_upload— unix ts of the last time data was sent for the file.shared_since— when the file was completed / first shared.upload_speed_bps+uploadingare live (refresh every tick); the two timestamps persist inknown.metand read0when unknown.Core
All Tier-1 data already existed on
CKnownFile::m_ClientUploadList; addedGetUploadDatarate()/GetTransferringClientCount()(summed live) plus two persisted timestamps:m_lastUploadDatetimestamped inCFileStatistic::AddTransferred(the single upload-bytes chokepoint), andm_dateSharedstamped once at completion / first-hash. Uploading never rewrites the file, so — unlike a download's mtime-backed "last reception" — the upload timestamp needs its own tag.EC + dirty-marking
Four new
EC_TAG_KNOWNFILE_*tags (0x0417–0x041A); the live ones emit before theEC_DETAIL_UPDATEearly-return likeEC_TAG_PARTFILE_SPEED.SetUploadStatemarks the file EC-dirty onUS_UPLOADINGtransitions so a file that stops uploading but stays queued decays to0— completed/shared files have no per-tickProcess()sweep the way downloads do.known.met compatibility
The two timestamps are additive
FT_*tags. An older aMule reads them fine (unrecognized tags fall through todefault:and are preserved inm_taglist, then rewritten on save), so they survive a downgrade round-trip and never corrupt anything. New state is tags-only; the fixed header is unchanged.Verification
Build clean (amuled + amuleapi + amulegui); webapi ctests 4/4 (RefresherTest decodes the new tags); curl
0469/69 live against a connected daemon; clang-format (cf18) + clang-tidy Tier-2 clean. amulegui built from this branch connects to a 3.0.1 remote amuled without issue (new fields simply absent). Rebased on current master.Desktop GUI columns (amule/amulegui) that consume these are a follow-up, as noted in the issue.