Skip to content

Apple native network path (Mac Catalyst) has no request deadlines and no cancellation #72

Description

@andinux

The libcurl networking path now bounds every request and can cancel one in flight:

  • 30 s to connect, name resolution included (threaded resolver);
  • 300 s for an API request (check, upload URL, apply, status);
  • payload transfers bounded on progress (below 1024 B/s for 60 s aborts) with a 3600 s backstop;
  • sqlite3_interrupt() aborts a call in flight, which then fails with SQLITE_INTERRUPT;
  • all of it tunable at runtime through the network_* keys of cloudsync_set.

The Apple-native path (src/network/network.m, used when NATIVE_NETWORK=ON, which Mac Catalyst builds force) has none of this. It creates its requests without setting any timeout, so it runs on the NSURLSession defaults: 60 s of inactivity per request and 7 days per resource. There is also no cancellation, so a stalled transfer holds the database connection until the system gives up.

What it needs

  • Map the two policies onto NSURLSessionConfiguration / NSMutableURLRequest: timeoutIntervalForRequest and timeoutIntervalForResource, with the same split between API calls and payload transfers. NSURLSession has no direct equivalent of a low-speed limit; the progress of a transfer can be watched through the delegate, or the resource timeout used as an approximation.
  • Honour the same cloudsync_set keys, so behaviour does not depend on which transport a build uses.
  • Cancel the task when sqlite3_is_interrupted() reports the connection was interrupted, and report SQLITE_INTERRUPT like the libcurl path.

The unit tests for this live in test/network_unit.c and are built against libcurl, so the native path needs its own coverage or a manual check on a Mac Catalyst build.

Activity

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