Skip to content

Support negotiated accelerated OP_OFFERFILES publication on capable servers #932

Closed as not planned

Description

@itlezy

Problem

aMule uses fixed legacy pacing when publishing shared files to its connected
ED2K server:

  • at most 200 files per OP_OFFERFILES packet;
  • approximately one packet every 60 seconds.

This is appropriate for unknown and legacy servers, but newer server
implementations may be able to advertise and enforce a higher publication rate.

At present, aMule has no safe way to distinguish such a server from one which
may disconnect or penalize a client for publishing too quickly.

A large advertised ST_SOFTFILES value is not sufficient evidence. It
describes the number of files accepted from a client, not the permitted packet
size or packet rate.

Current code

CSharedFileList::SendListToServer() limits each batch to 200 files:

uint32 limit = server ? server->GetSoftFiles() : 0;
if (limit == 0 || limit > 200) {
    limit = 200;
}

CSharedFileList::Process() then waits for the fixed
ED2KREPUBLISHTIME, currently one minute, before another batch.

Relevant files:

  • src/SharedFileList.cpp
  • src/include/protocol/ed2k/Constants.h
  • the server-tag parsing and CServer state classes

Proposed behavior

Support a documented, opt-in server capability describing its OFFERFILES
policy.

When the capability is absent or invalid, aMule must retain its current legacy
behavior.

When present, aMule may use the server-advertised:

  • maximum files per batch;
  • minimum interval between batches or sustainable publication rate;
  • capability version;
  • optional future acknowledgement support.

The existing server soft/hard limits should continue to bound the total number
of files offered during the session.

A companion server-side proposal is being discussed here:

Safety requirements

The client must not enable accelerated publication based only on:

  • server name;
  • server software/version string;
  • IP address;
  • a large ST_SOFTFILES or ST_HARDFILES value.

Capability values must be validated and constrained by local safety ceilings.
A malicious or broken server must not be able to request an unlimited batch,
zero-delay loop, excessive memory allocation or excessive network traffic.

Conceptually:

batch =
    min(server_advertised_batch,
        local_safety_maximum,
        remaining_session_allowance,
        eligible_files)

delay =
    max(server_advertised_minimum_interval,
        local_safety_minimum_interval)

Server-specific capability state must be cleared when disconnecting or changing
servers.

Failure behavior

If a capable server:

  • rejects a batch;
  • sends an invalid response;
  • reports throttling;
  • or disconnects during accelerated publication,

aMule should log the reason and fall back to legacy pacing for the next
connection unless the capability is negotiated again.

An optional expert per-server override could help test an implementation before
the wire extension is widely deployed, but it should not be enabled globally by
default.

Observability

Logs or statistics should expose:

  • negotiated capability version;
  • effective batch size and interval;
  • total session soft/hard limit;
  • files offered and remaining;
  • whether legacy or accelerated mode is active;
  • fallback reason.

Expected benefit

For 60,000 shared files:

Publication policy Approximate initial pass
200 files every 60 seconds 5 hours
200 files every 10 seconds 50 minutes
200 files every 5 seconds 25 minutes
200 files every 1 second 5 minutes

This improves discovery through the connected ED2K server only. It does not
change Kad source or keyword publication behavior.

Acceptance criteria

  • No behavioral change for legacy or unknown servers.
  • No detection based on server identity or soft limit alone.
  • Negotiated values are locally validated and clamped.
  • Session publication does not exceed the server's advertised total limits.
  • Capability state cannot leak across server connections.
  • Invalid negotiation and disconnects fail safely.
  • Packet counts include exactly the records written to the packet.
  • Unsupported large files are not counted or marked as published.
  • Tests cover legacy fallback, valid negotiation, invalid values, server
    changes, session limits and interrupted publication.

Activity

  1. github-actions commented on Sep 30, 2026

    @github-actions

    👋 Thanks for the report.

    Please file new issues at the project's current home: https://github.com/amule-org/amule/issues

    Issue tracking has moved off this repository; this one is kept as a mirror of the codebase only. New issues filed here are auto-closed and locked because nobody monitors them. The original text of your report is preserved above, so you can copy it across.

    Sorry for the friction.

  2. locked as resolved and limited conversation to collaborators on Sep 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions