mirror of
https://github.com/itsPLK/ps5-pkg-manager.git
synced 2026-10-22 11:53:08 -05:00
* ws: direct-install streaming over WebSocket (RAM-only, no disk spool) Browser pushes .pkg bytes over ws://:8846 while the PS5 installer pulls ranges over :8845 concurrently through a demand-paged 1MB-segment ring (64 slots, seg 0 pinned). Install can start at header_ready, mid-upload. Backend (src/ws_stream.c, src/ws_upload.c): - ws_live_* ring with waiter shielding, served-past / waited+acked / peak>0+acked LRU eviction, single store_seg_locked() truth shared by blocking write and non-blocking try_write (0/-1/-2 busy). - Conn worker never blocks on storage (busy reply, browser retries); socket idle kill suppressed while readers are parked; stall diagnostics when a write parks. - http_server.c: guarded /api/upload/* REST branch; multipart.c live: scheme adapter (frozen pull path untouched); installer_start_live. Frontend: DirectInstallView + useDirectUpload pusher (FIFO seek queue for parallel installer workers, busy requeue+retry, demand-paging standby until install finalizes, silent-socket watchdog), wired into the history router (#/direct-install, Circle-back closes it). Parser: pkg_parser_parse_mem reuses in-file sub-parsers for live header parsing (differential-tested). Tests: ring unit (test_ws_stream), far-seek/pivot/busy/waiter unit (test_ws_stream_far), transport (test_ws_upload, incl. socket busy->retry), concurrent e2e incl. 90MB/64-slot parallel-pivot replay of the production capture (test_direct_install_e2e), PS5 pull-replay simulator (ps5_sim) + CLI tools. Proven on console: 1GB PKG installs at status='playable' with zero idle kills. Full host suite (13 binaries + CSS) green. * perf(smb): pipeline reads for faster package streaming Use a private SMB session per stream connection and keep up to eight credit-aware reads in flight, with requests up to 512 KiB. Reduce each request to the credits available in the current SMB2 window, including queued requests, so libsmb2 cannot silently shorten a request and leave a gap in the stream. Increase stream and socket buffers, and leave signing optional while still honoring servers that require it. Add SMB timing and throughput logs plus negotiated session diagnostics to separate SMB read latency from HTTP streaming overhead. Include the SMB logger in PS5 and host builds and update the mock async API used by tests. * fix(ws): harden direct install sessions and package preview Tie uploads to a browser owner and one authenticated WebSocket. Resume from acknowledged segments so cache eviction does not lose progress. Move Direct Install into media sources, show local PKG title and icon before installation, and warn before leaving an active transfer. Pass package metadata to the live installer and cover ownership and metadata parsing with tests. * fix(smb): honor package install debug setting Gate SMB debug file creation and per-read diagnostics behind pkg_install_debug, matching WebSocket stream logging behavior. Keep regular SMB package streaming unchanged. * fix(ui): return direct install to drives route Make the Direct Install Back to drives action replace the current route and restore the media source view directly. This prevents browsers that opened the page from leaving the app for an unrelated previous history entry. * fix(ui): restore deep-linked pages on reload Apply the initial hash route to the visible view during startup, including storage media and package details. Load package data for the linked drive so a direct package URL opens its detail page after a reload. * fix(ui): accept package drops across the app Handle package drops at the application level, open Direct Install, and pass the file through the existing package preview flow. Keep active uploads and installations protected from replacement. * fix(direct): check package eligibility before install Share the scanner's installed state and version rules with Direct Install. Check selected package metadata before enabling Install and again before starting a new transfer, while preserving resumed sessions. Show storage and active install blockers on the direct install page. * fix(direct): share live install icon across browsers Upload the parsed package icon once to the active direct install session and serve it from RAM through the existing icon API. Other browsers can resolve the live session path shown in installer status. Clear icon data when the session is canceled or replaced. * fix(direct): cancel install when uploader closes Use sendBeacon during browser teardown to call the authenticated Direct Install cancel endpoint for the sending session. Keep observer browsers unaffected and avoid duplicate cancellation requests. * fix(direct): cancel when uploader socket closes Treat an unexpected close of the authenticated uploader WebSocket before the final finish message as an install cancellation. Preserve normal completed sessions and reduce repetitive seek, eviction, and read-short logging in the main log. * bump version to 1.1.1 * fix(ui): stop duplicate direct upload polling Keep the observer watchdog stable across renders, disable it for the owning upload tab, and prevent overlapping status requests in both polling paths. * Add PS4 and PS5 package badges * feat: support platform-aware install storage * fix: preserve catalog during provisional scans * bump version to 1.2.0 * docs: add changelog for 1.2.0 * chore: remove stale refactor references * feat: move streaming services to dedicated ports * docs: update 1.2.0 documentation
77 lines
2.5 KiB
C
77 lines
2.5 KiB
C
/*
|
|
* PKG Manager - SMB Streaming Debug Logger
|
|
*
|
|
* Records timing, throughput and per-slot detail for every SMB read
|
|
* made during a streaming install. Produces a timestamped text file in
|
|
* /data/pkgmgr/ (or $PKG_DEBUG_DIR) that can be compared with the
|
|
* stream_debug_log to isolate where the Samba speed gap comes from.
|
|
*
|
|
* /data/pkgmgr/smb_debug_<server>_<YYYYMMDD_HHMMSS>.txt
|
|
*
|
|
* Thread-safe: uses its own mutex. Safe to call when not open.
|
|
*/
|
|
#ifndef SMB_DEBUG_LOG_H
|
|
#define SMB_DEBUG_LOG_H
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#include <stdint.h>
|
|
#include <stddef.h>
|
|
#include <sys/types.h>
|
|
|
|
/* Monotonic microsecond clock used internally for slot RTT measurements.
|
|
* Exposed so smb_client.c can timestamp issue/completion without a separate
|
|
* gettimeofday call. */
|
|
uint64_t smb_dbg_now_us_internal(void);
|
|
|
|
/*
|
|
* Open a new SMB debug log for one streaming session.
|
|
* server - NAS hostname/IP
|
|
* share - SMB share name
|
|
* smb_url - full smb:// path being streamed
|
|
* file_size - total file size in bytes
|
|
* Returns 0 on success, -1 if the file could not be created (logging will
|
|
* be silently disabled for this session).
|
|
*/
|
|
int smb_debug_log_open(const char *server, const char *share,
|
|
const char *smb_url, uint64_t file_size);
|
|
|
|
/*
|
|
* Record one completed smb_file_session_read() call.
|
|
* offset - file offset requested
|
|
* requested - bytes the caller wanted
|
|
* returned - bytes actually delivered to the caller
|
|
* elapsed_us - wall-clock microseconds the call took
|
|
* n_slots - number of async pipeline slots that fired
|
|
*/
|
|
void smb_debug_log_read(uint64_t offset, size_t requested,
|
|
ssize_t returned, uint64_t elapsed_us,
|
|
int n_slots);
|
|
|
|
/*
|
|
* Record one async-slot completion inside smb_file_session_read().
|
|
* slot_idx - slot index (0 .. SMB_PIPELINE_DEPTH-1)
|
|
* offset - file offset this slot was fetching
|
|
* requested - bytes this slot requested from smb2_pread_async
|
|
* returned - bytes libsmb2 actually delivered (may be < requested when
|
|
* credit-limited)
|
|
* rtt_us - microseconds from smb2_pread_async call to callback fire
|
|
*/
|
|
void smb_debug_log_slot(int slot_idx, uint64_t offset,
|
|
uint32_t requested, int returned,
|
|
uint64_t rtt_us);
|
|
|
|
/*
|
|
* Write a one-line summary (total bytes, wall time, average throughput)
|
|
* and close the log file. Safe to call when not open.
|
|
*/
|
|
void smb_debug_log_close(void);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* SMB_DEBUG_LOG_H */
|