MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / read

Method read

modules/crypt/ssl/session_419.js:192–210  ·  view source on GitHub ↗
(s)

Source from the content-addressed store, hash-verified

190 return false;
191 }
192 read(s) {
193 while (s.readable) {
194 if (!this.applicationData) {
195 // read at least one packet and just keep it
196 const buf = this.readPacket(s);
197 if (!buf)
198 return;
199 this.startTrace("unpacketize");
200 recordProtocol.unpacketize(this, buf);
201 if (this.alert)
202 return null; // probably the session has been closed by the peer
203 }
204 if (this.applicationData) {
205 const applicationData = this.applicationData;
206 delete this.applicationData;
207 return new Uint8Array(applicationData.buffer, applicationData.position, applicationData.end - applicationData.position);
208 }
209 }
210 }
211 write(s, data, options) {
212 if (options?.more) {
213 this.#buffer ??= new SSLStream(undefined, options.byteLength);

Callers

nothing calls this directly

Calls 2

readPacketMethod · 0.95
startTraceMethod · 0.95

Tested by

no test coverage detected