Repository navigation
MCP: progress notifications for long scans, and cancellation - #536
Merged
Merged
Conversation
Progress: discover_network, scan_ports and sweep_network send notifications/progress when the request carries _meta.progressToken. The core already reports per-port and per-host progress; server/progress.rs maps each operation's phases onto one 0-1000 scale so the count only rises, and sends at most one notification per 250 ms plus the final one. The reporter is a task-local set around the request, read only by those three operations. Cancellation: notifications/cancelled with a requestId aborts that request's task (server/inflight.rs), and no response is sent for it, as the protocol asks. Before, the call ran to the end holding a request slot. End to end on netscli serve: a /24 sweep sent 6 progress notifications in 2.05 s ending at 1000/1000; a 4,096-port scan cancelled after 1 s was never answered while a tools/list sent after the cancel was answered at once. Tests cover throttling, monotonic progress, phase mapping and cancel; the cancel test fails with the abort removed.
Contributor
|
Site preview: https://pr-536.netscli-site-preview.pages.dev Built from 21e0084 with Production is unaffected: netscli.com is served from GitHub Pages via |
…rs under 300 lines
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.
Gap 2 from the audit.
Progress.
discover_network,scan_portsandsweep_networksendnotifications/progresswhen the request carries_meta.progressToken. The core already reported per-port and per-host progress;server/progress.rsmaps each operation's phases onto one 0 to 1000 scale (the protocol requires progress to only increase), and sends at most one notification every 250 ms, plus the final one.Cancellation.
notifications/cancelledwith arequestIdaborts that request's task (server/inflight.rs), and no response is sent for it, as the protocol asks. Before, the call ran to the end and held one of the 16 request slots.End to end on
netscli serve(release build):The jump from 31 to 522 is the ping phase: most pings finish together at the 1 s timeout, so progress there moves in a step.
Tests: throttling, never going backwards, phase mapping, no reporter without a token, cancel aborts a running task, unknown ids ignored,
1and"1"kept apart. The cancel test fails with the abort removed.Docs: a "Progress and cancelling" section in the MCP page. CHANGELOG under Unreleased.