@ai-ecoverse/slicc-kernel 1.159.2 → 1.159.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/node.js CHANGED
@@ -2001,41 +2001,42 @@ var KernelSocket = class _KernelSocket {
2001
2001
  }
2002
2002
  async read(max, signal) {
2003
2003
  const { rx } = this.connection();
2004
- if (this.refused) throw this.refused;
2004
+ this.drained(rx);
2005
2005
  if (this.readShut || max <= 0) return new Uint8Array(0);
2006
2006
  const bytes = await pipeCall(() => rx.read(max, signal));
2007
- if (this.refused) throw this.refused;
2007
+ if (bytes.length === 0) this.drained(rx);
2008
2008
  if (bytes.length === 0 && this.reset) throw this.reset;
2009
2009
  return bytes;
2010
2010
  }
2011
2011
  async peek(max, signal) {
2012
2012
  const { rx } = this.connection();
2013
- if (this.refused) throw this.refused;
2013
+ this.drained(rx);
2014
2014
  if (this.readShut || max <= 0) return new Uint8Array(0);
2015
2015
  const bytes = await pipeCall(() => rx.peek(max, signal));
2016
- if (this.refused) throw this.refused;
2016
+ if (bytes.length === 0) this.drained(rx);
2017
2017
  if (bytes.length === 0 && this.reset) throw this.reset;
2018
2018
  return bytes;
2019
2019
  }
2020
+ drained(rx) {
2021
+ if (this.refused && rx.buffered === 0) throw this.refused;
2022
+ }
2020
2023
  rightsLink() {
2021
2024
  const link2 = this.connection();
2022
2025
  if (this.domain !== "unix" || this.switch || this.served) throw new KernelError("EOPNOTSUPP");
2023
- if (this.refused) throw this.refused;
2024
2026
  return link2;
2025
2027
  }
2026
2028
  sendRights(bytes, mark, nonblock, signal) {
2027
2029
  const { tx } = this.rightsLink();
2030
+ if (this.refused) throw this.refused;
2028
2031
  if (this.writeShut) throw new KernelError("EPIPE");
2029
2032
  return pipeCall(() => tx.writeMarked(bytes, (at) => mark(at, tx.inFlight), nonblock, signal));
2030
2033
  }
2031
2034
  async receiveRights(max, nonblock, signal) {
2032
2035
  const { rx } = this.rightsLink();
2036
+ this.drained(rx);
2033
2037
  if (this.readShut || max <= 0) return { bytes: EMPTY, marks: [] };
2034
2038
  const got = await pipeCall(() => rx.receive(max, nonblock, signal));
2035
- if (this.refused) {
2036
- for (const mark of got.marks) mark.drop();
2037
- throw this.refused;
2038
- }
2039
+ if (got.bytes.length === 0) this.drained(rx);
2039
2040
  return got;
2040
2041
  }
2041
2042
  get secured() {
@@ -3669,7 +3670,7 @@ function satisfies(version, range2) {
3669
3670
  }
3670
3671
 
3671
3672
  // src/version.ts
3672
- var KERNEL_VERSION = true ? "1.159.2" : "0.0.0-dev";
3673
+ var KERNEL_VERSION = true ? "1.159.3" : "0.0.0-dev";
3673
3674
  var OS_RELEASE = "6.0.0-slicc";
3674
3675
  function procVersion() {
3675
3676
  return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC