forked from 1b-agent/opencadstudio-upstream
docs(ipc): clarify polled response reads
This commit is contained in:
1 parent
77a834800c
commit
94f5971fdb
1 file changed
+2
-7
@@ -185,10 +185,7 @@ impl ProxyPluginRequestSender {
|
|||||||
/// [`POLL_INTERVAL`] while waiting. This lets Python callers run
|
/// [`POLL_INTERVAL`] while waiting. This lets Python callers run
|
||||||
/// `py.check_signals()` so that `Ctrl+C`/`KeyboardInterrupt` is raised
|
/// `py.check_signals()` so that `Ctrl+C`/`KeyboardInterrupt` is raised
|
||||||
/// promptly instead of waiting for the full socket timeout.
|
/// promptly instead of waiting for the full socket timeout.
|
||||||
///
|
/// Partial reads are preserved across timeouts to keep framing synchronized.
|
||||||
/// The response is read byte-by-byte with polling so that a short timeout
|
|
||||||
/// can never leave the TCP stream in a partially-read state between the
|
|
||||||
/// length prefix and the payload.
|
|
||||||
pub fn request_with_poll(
|
pub fn request_with_poll(
|
||||||
&self,
|
&self,
|
||||||
req: PluginRequest,
|
req: PluginRequest,
|
||||||
@@ -209,9 +206,7 @@ impl ProxyPluginRequestSender {
|
|||||||
let result = match recv_framed_with_poll(&mut *stream, poll) {
|
let result = match recv_framed_with_poll(&mut *stream, poll) {
|
||||||
Ok(resp) => Ok(resp),
|
Ok(resp) => Ok(resp),
|
||||||
Err(PollError::Interrupted(e)) => {
|
Err(PollError::Interrupted(e)) => {
|
||||||
// The caller (e.g. Python's Ctrl+C handler) asked us to stop
|
// A partial response cannot be reused after interruption.
|
||||||
// waiting. Shut down the stream immediately so the proxy server
|
|
||||||
// and any spawned runners can observe the disconnect.
|
|
||||||
let _ = stream.shutdown(Shutdown::Both);
|
let _ = stream.shutdown(Shutdown::Both);
|
||||||
Err(e)
|
Err(e)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user