mirror of
https://github.com/gnif/LookingGlass.git
synced 2026-08-22 15:11:31 +00:00
[client] clipboard: reduce remote file transfer latency
Mark the last non-empty FILE_DATA payload with BEGIN and END when the producer knows it is terminal. Complete producer bookkeeping in the following fileDataEnd call without consuming another LGMP grant. Keep the standalone terminal record for empty and legacy unknown streams. Drain up to 64 queued clipboard records per worker pass instead of sleeping after every message. Poll at 1 ms while transfers, blocked writes, held input, or pending output are active, and retain the 10 ms interval while idle. This removes a serialized grant round trip from every non-empty file response and reduces scheduling delay while a large transfer is active. Keep the 1 MiB payload size because the bottleneck was stop-and-wait latency, not the chunk capacity. Exercise a full 1 MiB response in a single BEGIN|END grant and retain coverage for empty unknown-size responses.
This commit is contained in:
@@ -66,7 +66,7 @@ LG_ClipboardResult lgClipboard_fileDataBegin(
|
||||
const LG_ClipboardFileRequest * request, uint64_t sizeHint);
|
||||
LG_ClipboardResult lgClipboard_fileDataChunk(
|
||||
const LG_ClipboardFileRequest * request, uint64_t responseOffset,
|
||||
const void * data, size_t size);
|
||||
const void * data, size_t size, bool end);
|
||||
LG_ClipboardResult lgClipboard_fileDataEnd(
|
||||
const LG_ClipboardFileRequest * request, uint64_t finalSize);
|
||||
bool lgClipboard_fileCancel(uint64_t dataset, uint64_t request,
|
||||
|
||||
@@ -247,9 +247,12 @@ typedef struct LG_ClipboardOps
|
||||
const LG_ClipboardFileRequest * request);
|
||||
LG_ClipboardResult (*fileDataBegin)(void * opaque,
|
||||
const LG_ClipboardFileRequest * request, uint64_t sizeHint);
|
||||
/* end marks a final non-empty chunk. fileDataEnd must still be called to
|
||||
* complete the producer-side stream; it emits a terminal record only when
|
||||
* the final chunk was not marked, including for an empty response. */
|
||||
LG_ClipboardResult (*fileDataChunk)(void * opaque,
|
||||
const LG_ClipboardFileRequest * request, uint64_t responseOffset,
|
||||
const void * data, size_t size);
|
||||
const void * data, size_t size, bool end);
|
||||
LG_ClipboardResult (*fileDataEnd)(void * opaque,
|
||||
const LG_ClipboardFileRequest * request, uint64_t finalSize);
|
||||
bool (*fileCancel)(void * opaque, uint64_t dataset,
|
||||
|
||||
Reference in New Issue
Block a user