Repository navigation
Conversation
K1-family printers keep /usr/data; K2/K2 Pro/K2 Plus/SPARKX i7 use /mnt/UDISK. start_print now returns a failure to the job callback, and print_host URLs are stripped of scheme/port before the WebSocket connect. K1, K1 SE, K1C, K1_CFS-C and K2 Plus profiles get host_type crealityprint. Co-authored-by: aceRage <aceRage@users.noreply.github.com>
Synchronous Beast ignores tcp_stream::expires_after, so a silent printer could hang start_print. Every resolve/connect/handshake/write/read now runs async with io_context::run_for and closes the socket on expiry. When /info is empty or unknown, the preset printer_model chooses the K1 /usr/data root so a K1 never regresses to /mnt/UDISK. Co-authored-by: aceRage <aceRage@users.noreply.github.com>
A zero remaining budget used to cancel run() without draining, so a queued handler could write to dead stack locals when close() polled the ioc. Refuse to start an async step when budget() is 0, and always drain after cancel. Literal IPs skip resolve because resolver.cancel() cannot interrupt getaddrinfo. Co-authored-by: aceRage <aceRage@users.noreply.github.com>
This was referenced Oct 19, 2026
cancel() only sets the atomic flag and net::post()s cancel_socket(). It no longer calls ioc.stop() or touches open/ws off-thread, and open() does not clear a cancel that already happened. run() still drains on every timeout and cancel path. Co-authored-by: aceRage <aceRage@users.noreply.github.com>
This was referenced Oct 19, 2026
This branch has not been deployed
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.
Description
Phase 1 of the Creality send-gap stack (research C1+C2+C5). Closes the “Upload and print reports success but never starts” class of bugs on K2-platform printers, and surfaces start failures instead of swallowing them.
Does not affect Snapmaker printers. Needs a Creality K1/K2 hardware smoke before merge (not a U1 check).
Review 1/3 (F1, F2)
tcp_stream::expires_afterdoes nothing on synchronous Beast.CrealityWsClientnow runs every resolve / connect / handshake / write / read as an async op withio_context::run_for, and closes the socket on expiry. Shared bystart_print, the Phase 2 CFS probe, and Phase 3 sync./infois empty or unknown,resolve_model()falls back to the presetprinter_model(Creality K1C→K1C) so a K1 never regresses to/mnt/UDISK.Re-review 1/3 (B3, F15)
ready_to_start()refuses to start an op whenbudget() <= 0or the client is cancelled, andrun(timeout_ms <= 0)still cancels thenioc.restart(); ioc.run()so every path drains before the locals go out of scope.resolver.cancel()cannot interruptgetaddrinfo; the DNS wait is bounded by the OS. Literal IPv4/IPv6 skip resolve viaasio::ip::make_address.Re-review 2/3 (B5)
cancel()is now UI-thread safe. It only storescancelledandnet::post()scancel_socket()onto this client’sio_context. It does not callioc.stop()and does not touchopen/wsoff-thread.open()no longer clearscancelled, so a cancel beforeopen()is not lost.openisstd::atomic<bool>(worker-only writes). Everyrun()path still drains (B3): timeout, already-cancelled, and cancel-during-run_forallon_timeout()thenioc.restart(); ioc.run().open(), and during a never-accepting connect.Upstream sources
CrealityPrint.cppis_k1_family(),/infomodel query, omit multipartpathon CFS models,start_printbool +error_fn).Http::get_host_from_url— this fork’s equivalent isHttp::url_host(scheme and port stripped).crealityprint+printer_agent: crealityprinton K1 / K1 SE / K1C / K1_CFS-C / K2 Plus.What was adapted
CrealityPrintModel.hppso Catch2 can pin them without a printer. Not a cherry-pick of upstreamCrealityPrint.cpp.PrintHost::apply_tlson/infoand upload (upstream still uses#ifdef WIN32 ssl_revoke_best_effortonly).start_printstill sends onlyopGcodeFile(CFScolorMatch/multiColorPrintis Phase 2). Root is/usr/datafor K1-family (including preset names) and/mnt/UDISKfor everything else (K2 / K2 Pro / K2 Plus / SPARKX i7).Http::url_hostso aprint_hostwritten ashttp://host:80resolves.error_fnand returns false fromupload().host_type/printer_agentadded (oroctoprint→crealityprinton K1_CFS-C). No other preset fields touched. Cross-checked against Profiles: Creality preset sanity fixes #319 (Creality sanity: default process /max_layer_height) and Profiles: refresh vendors to upstream Orca + preset sanity fixes #320 (Creality was out of scope). Vendor version02.03.02.05→02.03.02.06.Expected conflicts
CrealityPrint.cppor these profiles).Untested
slic3rutils_testswas not compiled here. Catch2 cases were added to the existingtests/slic3rutils/printhost_devices_tests.cpp(no CMake test edits).Tests
Catch2 v2 in
printhost_devices_tests.cpp:/usr/data/..., omit uploadpath/mnt/UDISK/.../infofalls back to presetprinter_modelws_hoststrips scheme and portparse_model_from_infois hostile-JSON safeopen()and during a never-accepting connect (B5)Smoke checklist (Creality hardware)
/usr/data/printer_data/gcodes./mnt/UDISK/printer_data/gcodes(the old/usr/datapath is the C1 bug).print_hostashttp://<ip>andhttp://<ip>:80still connects (scheme/port stripped)./infoomitsmodelstill uses/usr/data(preset fallback).