(s, n)
| 186 | return false; |
| 187 | } |
| 188 | read(s, n) { |
| 189 | let applicationData = this.applicationData; |
| 190 | if (!applicationData || (0 == applicationData.byteLength) || (applicationData.position >= (applicationData.byteLength + applicationData.byteOffset))) { |
| 191 | // read at least one packet and just keep it |
| 192 | let buf = this.readPacket(s, s.read()); // bytesAvailable |
| 193 | if (!buf) |
| 194 | return applicationData; // return an empty buffer |
| 195 | this.startTrace("unpacketize"); |
| 196 | recordProtocol.unpacketize(this, buf); |
| 197 | if (this.alert) |
| 198 | return null; // probably the session has been closed by the peer |
| 199 | } |
| 200 | if (n === undefined) |
| 201 | return this.applicationData; // return the whole data whether it is empty or not -- DO NOT modify the content |
| 202 | |
| 203 | if (applicationData) { |
| 204 | let data = new Uint8Array(applicationData.buffer, applicationData.position, n); |
| 205 | applicationData.position += n; |
| 206 | |
| 207 | if (applicationData.position >= applicationData.end) |
| 208 | delete this.applicationData; |
| 209 | |
| 210 | return data; |
| 211 | } |
| 212 | return null; |
| 213 | } |
| 214 | write(s, data) { |
| 215 | if (data.byteLength > maxFragmentSize) |
| 216 | return -1; // too large |
nothing calls this directly
no test coverage detected